iview中Select 下拉框 多选 校验方法

it2024-11-18  2

<FormItem label="学科:" prop="teachingCourse"> <Select v-model="formData.teachingCourse" clearable multiple placeholder="选择教授的学科" > <Option v-for="item in SUBJECTLIST" :value="item.value" :key="item.value" >{{ item.value }}</Option > </Select> </FormItem> formDataValidate: { teachingCourse: [ { type:'array', required: true, message: "学科不能为空", trigger: "change" }, ] }

校验中加‘type:‘array’,否则不能通过校验

最新回复(0)