vue+element-ui表单校验之数组多层嵌套

表单校验两层数组嵌套


        
form: {
        collectKidDtoList: []
},
rules: {
        collectCode: [
          { required: true, message: '必填', trigger: 'blur' },
          {
            validator(rule, value, callback) {
              if (/^[A-Za-z0-9]+$/.test(value.trim())) {
                callback()
              } else {
                callback(new Error('请输入字母或数字'))
              }
            },
            trigger: 'blur'
          }
        ],
        collectName: [{ required: true, message: '必填', trigger: 'blur' }]
}

你可能感兴趣的:(vue+element-ui表单校验之数组多层嵌套)