| | |
| | | </el-row> |
| | | <el-row v-if="item.questionType === 1"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="选项" style="width: 100%;" :prop="item.answerList"> |
| | | <el-form-item label="选项" style="width: 100%;" :prop="`${index}`" :rules="[ |
| | | { |
| | | validator: answerListField, |
| | | } |
| | | ]"> |
| | | <div |
| | | v-for="(ele, childIndex) in item.answerList" |
| | | :key="index" |
| | |
| | | callback() |
| | | } |
| | | } |
| | | function answerListField(rule: { field: string | number }, value: any, callback: any) { |
| | | if(form.value.questionList[rule.field].answerList.length < 2) { |
| | | callback(new Error('请至少添加两项')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | function changeValue(event, index, childIndex) { |
| | | // form.value.questionList[index].isScore = event.target. |
| | | form.value.questionList[index].answerList.forEach((item: { isScore: number }) => { |