cnpm i vue2-toast -S
import 'vue2-toast/lib/toast.css';
import Toast from 'vue2-toast';
Vue.use(Toast);
checkphone: function() {
var reg = /^1[3456789]\d{9}$/;
if (this.name == "") {
this.$toast.center("请输入姓名");
}
if (this.phone == "") {
this.$toast.center("请输入手机号");
} else if (this.phone != "") {
if (!reg.test(this.phone)) {
this.$toast.center("请输入准确的手机号");
return false;
}
}
if (this.attr == "") {
this.$toast.center("请输入详细地址");
}
if (this.name != "" && reg.test(this.phone) && this.attr != "") {
this.$router.push({ path: "shouhuodizhi" });
}
}