45 行
1.2 KiB
JavaScript
可执行文件
45 行
1.2 KiB
JavaScript
可执行文件
new Vue({
|
|
el: "#app",
|
|
data: {
|
|
username: "此乃用户昵称",
|
|
fullName: '',
|
|
sex: '',
|
|
phone: '17722229999',
|
|
Birthday: '',
|
|
},
|
|
methods: {
|
|
subset: function() {
|
|
if (!this.username) {
|
|
this.$message({
|
|
message: '昵称不能为空',
|
|
duration: 1500,
|
|
customClass: 'tip'
|
|
});
|
|
} else if (!this.fullName) {
|
|
this.$message({
|
|
message: '姓名不能为空',
|
|
duration: 1500,
|
|
customClass: 'tip'
|
|
});
|
|
} else if (!this.call(this.phone)) {
|
|
this.$message({
|
|
message: '手机号码输入有误',
|
|
duration: 1500,
|
|
customClass: 'tip'
|
|
});
|
|
}else{
|
|
this.$message({
|
|
message: '修改成功',
|
|
duration: 1500,
|
|
customClass: 'tip',
|
|
type: 'success'
|
|
});
|
|
}
|
|
|
|
},
|
|
call: function(phone) {
|
|
var re = /^1(3|4|5|7|8)\d{9}$/;
|
|
return re.test(phone);
|
|
}
|
|
}
|
|
}) |