check.js 879 Bytes
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
export default {
  data() {
    return {
      rules: {
        "swiadd.strinf": [{
            type: "string",
            required: false,
            message: "必输项"
          },
          {
            max: 35,
            message: "长度不能超过35"
          }
        ],
        "gidgrp.rec.purcan": [{
          type: "string",
          required: true,
          message: "必输项"
        }, ],
        "newref": [{
          // 表示校验规则对象
          validator: (rule, value, callback) => {
              // 如果输入值为空,则直接返回校验结果(false表示校验失败)
              if (this.model.gidgrp.rec.purcan === 'RN' && !value) {
                  callback('该项不能为空');
              } else {
                  callback();
              }
          },
          trigger: 'blur'
      }],
      }
    }
  }
}