{
value: '',
field: 'num',
disabled: false,
validators: {
required: {
required: true,
message: 'num号不能为空'
},
validateFun: {
validator: validateFun,
trigger: 'change'
}
},
layout: {
span: 8,
offset: 0,
row: 3
},
options: {
rows: 1,
type: 'text'
},
type: 'text',
title: 'num号'
},
验证规则:
const validateFun = (rule, value, callback) = > {
let reg = /^[a-z0-9]+$/i;
if (value) {
if (reg.test(value)) {
callback();
} else {
callback(new Error('num号限定为字母或者数字'));
}
// if (/\#|\\|\&|[\u4e00-\u9fa5]/.test(value)) {
// callback(new Error('不能输入中文或特殊字符'));
// }
} else {
callback();
}
callback();
};