<script> // 手机号验证 const validatePhone = (rule, value, callback) => { if (!value) { callback(new Error("请输入业户联系人手机号")); } else { const reg = /^1[3|4|5|6|7|8][0-9]\d{8}$/; if (reg.test(value)) { callback(); } else { return callback(new Error("业户联系人手机号不正确")); } } }; export default { data() { return { rules: { phone: [ {required: true,validator: validatePhone,trigger: "blur"} ] } } } } </script>