iview表单验证写法

ruleValidate: {
userName: [
{
required: true,
message: "用户名不能为空",
trigger: "blur"
},
{
type: "string",
pattern: /^[0-9a-zA-Z]*$/g,
message: "用户名只能是英文或者数字",
trigger: "blur"
}
],
password: [
{
required: true,
message: "密码不能为空",
trigger: "blur"
}
],
passwordList: [
{
required: true,
message: "密码不能为空",
trigger: "blur"
},
 
],
roleId: [
{
required: true,
message: "角色不能为空",
trigger: "blur"
}
],
fullName: [
{
required: true,
message: "该项不能为空",
trigger: "change"
},
{
type: "string",
pattern: /\u00A9/,
max: 4,
message: "姓名只能是中文且最大长度不能超过4",
trigger: "blur"
}
],
nickName: [
{ required: true, message: "昵称不能为空", trigger: "change" }
],
sex: [
{
required: true,
type: "number",
message: "性别不能为空",
trigger: "blur"
}
],
age: [
{
required: true,
type: "string",
message: "年龄不能为空",
trigger: "blur"
},
{
type: "string",
pattern: /^\d{n,}$/,
max: 3,
message: "年龄只能为数字且不能超超过3位数",
trigger: "blur"
}
],
mobileNum: [
{
required: true,
type: "string",
message: "手机号不能为空",
trigger: "blur"
},
{
type: "string",
pattern: /^[1][3,4,5,7,8][0-9]{9}$/,
message: "不符合手机号码规则",
trigger: "blur"
}
],
jobTitle: [
{
required: true,
message: "职务不能为空",
trigger: "blur"
}
],
status: [
{
required: true,
message: "状态不能为空",
trigger: "blur"
}
]
},

转载于:https://www.cnblogs.com/zhuwu/p/10613821.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值