iview Input 输入数字验证

验证规则中添加正则

{required: true, pattern: /^[a-z0-9]+$/, message: '请输入数字', trigger: 'change'}
    //参考 async-validator
    people: [
    { required: true, message: '请输入扫码解锁人数', trigger: 'blur' },
    { type: 'number', message: '请输入数字格式', trigger: 'blur', transform(value) {
        return Number(value);
    }}
],
posted @ 2019-01-09 10:13  沐荍  阅读(7968)  评论(0编辑  收藏  举报