import{a as V,r as h,f as k,w as u,aj as c,c as p,o as i,S as _,K as g,b as n,R as y,a9 as b,Q as B}from"./vue.D1BjjNmv.js";import{_ as A}from"./_plugin-vue_export-helper.DlAUqK2U.js";const C={class:"blank-answer-editor"},U={style:{width:"80px"}},q=V({__name:"BlankAnswerEditor",props:{modelValue:{},question:{}},emits:["update:modelValue"],setup(w,{emit:x}){const s=w,f=x,e=h([...s.modelValue]);return k(()=>(s.question||"").split("___").length-1),u(()=>e.value,a=>{f("update:modelValue",a)},{deep:!0}),u(()=>s.modelValue,a=>{e.value=[...a]},{deep:!0}),u(()=>s.question,a=>{const t=(a||"").split("___").length-1;t>0&&e.value.length!==t&&(e.value=Array.from({length:t},(m,o)=>{var r,l;return{blank_index:o+1,correct_answer:((r=e.value[o])==null?void 0:r.correct_answer)||"",score:((l=e.value[o])==null?void 0:l.score)||5}}))}),e.value.length===0&&(e.value=[{blank_index:1,correct_answer:"",score:5}]),(a,t)=>{const m=c("el-input"),o=c("el-input-number"),r=c("el-card");return i(),p("div",C,[_(r,null,{default:g(()=>[t[0]||(t[0]=n("div",{class:"blank-header"},[n("span",{style:{width:"80px"}},"填空序号"),n("span",{style:{flex:"1"}},"正确答案"),n("span",{style:{width:"120px","text-align":"center"}},"分值")],-1)),(i(!0),p(y,null,b(e.value,(l,v)=>(i(),p("div",{key:v,class:"blank-item"},[n("span",U,B(l.blank_index),1),_(m,{modelValue:l.correct_answer,"onUpdate:modelValue":d=>l.correct_answer=d,placeholder:"请输入正确答案",style:{flex:"1",margin:"0 10px"}},null,8,["modelValue","onUpdate:modelValue"]),_(o,{modelValue:l.score,"onUpdate:modelValue":d=>l.score=d,min:0,max:100,step:1,precision:0,controls:!1,style:{width:"120px"},placeholder:"分值"},null,8,["modelValue","onUpdate:modelValue"])]))),128)),t[1]||(t[1]=n("div",{class:"blank-tip"},' 提示：在题目中使用"___"（三个下划线）表示填空位置，系统会自动识别填空数量 ',-1))]),_:1})])}}}),S=A(q,[["__scopeId","data-v-2e7e9c8d"]]);export{S as default};
