liuyinglong / verify

71 stars 17 forks source link

可以自定义验证规则吗? #1

Closed webenters closed 7 years ago

webenters commented 7 years ago

我有个需求是在文本框里输入多个邮箱,以逗号分隔,需要验证格式

liuyinglong commented 7 years ago
var myRules={
    phone:{
        test:/^1[34578]\d{9}$/,
        message:"电话号码格式不正确"
    },
    max6:{
        test:function(val){
            if(val.length>6) {
                return false
            }
            return true;
        },
        message:"最大为6位"
    }

}
import Vue from "vue";
import verify from "vue-verify-plugin";
Vue.use(verify,{
    rules:myRules
});