阿里巴巴建设电子商务网站目的,百度西安,郑州哪个医院看妇科病最好的医院,飓风seo刷排名软件写需求时遇到一个这样的问题#xff0c;就是校样项是多个的#xff0c;但是其字段名称相同这时我们可以这样校验#xff0c;注意字段之间的关联性div v-for(item,index) in formData.hospitalDoctorList :keyitem.key || indexel-form-…写需求时遇到一个这样的问题就是校样项是多个的但是其字段名称相同这时我们可以这样校验注意字段之间的关联性div v-for(item,index) in formData.hospitalDoctorList :keyitem.key || indexel-form-item label科室:prophospitalDoctorList. index .hospitalDeptRelationId:rules[{ required: true, message: 请选择医生在此医院的科室, trigger:[change,blur] }]el-cascaderv-modelitem.hospitalDeptRelationId:disabled!item.hospitalPrefchangedeptChange(item, index):optionsitem.deptList:propsdeptStrictlyPropscollapse-tagsclearable//el-form-item 在 el-form-item 组件中:prop 属性用于指定该表单项对应的校验字段路径。这里的写法是字符串拼接最终会生成类似 hospitalDoctorList.0.hospitalDeptRelationId、hospitalDoctorList.1.hospitalDeptRelationId 这样的路径。hospitalDoctorList 是一个数组里面存放着多个医生或药师的信息对象。index 是当前循环的索引比如 0、1、2...通常在 v-for 循环中传入。hospitalDeptRelationId 是每个医生药师对象中的一个字段表示“药师id”。所以:prophospitalDoctorList. index .hospitalDeptRelationId就是告诉表单校验系统当前这个表单项对应的数据字段是 hospitalDoctorList 数组中第 index 个对象的 hospitalDeptRelationId 字段。这样做的好处是表单校验比如 required 校验可以精确地作用到每个医生药师对象的 hospitalDeptRelationId 字段上实现动态表单校验。可以实现这样的效果