# 普通用法
点击查看代码
rules: [
{
validator: (rule, value, callback) => {
if (value && value.length> 500) {
callback(new Error("备注字数不能超过500"));
} else {
callback();
}
},
trigger: "blur"
}
]
rules: [
{
required: true,
message: "请输入电话",
trigger: "blur"
},
{
pattern: /^1\d{10}$/,
message: '请填写正确的手机号码',
trigger: 'blur'
}
]
rules: [
{
pattern: /^\d+(.\d{1,2})?$/,
message: "**单价须大于等于0且最多两位小数",
trigger: "change"
}
]
rules: [
{ required: true, message: "请输入电话号码", trigger: "blur" },
{
pattern: /(^1\d{10}$)|(^0\d{2,3}-[1-9]\d{6,7}$)/,
message: '请填写正确的电话或者手机号码',
trigger: 'blur'
},
{ message: "电话号码不能超过50", trigger: "blur", max: 50 }
]
rules: [
{ required: true, message: "请选择单位地址", trigger: "change" },
{
type: "array",
len: 3,
message: "请选择完整单位地址",
trigger: "blur"
}
]
← moment