You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.6 KiB
43 lines
1.6 KiB
function login() {
|
|
return Vue.component('login', function (resolve, reject) {
|
|
axios.get("/login.html").then(function (response) {
|
|
resolve({
|
|
template: response.data,
|
|
data() {
|
|
return {
|
|
name: 'login'
|
|
};
|
|
},
|
|
mounted: function () {
|
|
console.log('mounted:login');
|
|
weui.form.checkIfBlur('#form', this.regexp);
|
|
},
|
|
computed: {
|
|
regexp: function () {
|
|
return {
|
|
regexp: {
|
|
userName: /^[^\s]+/,
|
|
password: /^[^\s]+$/
|
|
}
|
|
};
|
|
}
|
|
},
|
|
methods: {
|
|
submit: function () {
|
|
weui.form.validate('#form', function (error) {
|
|
console.log(error);
|
|
if (!error) {
|
|
var loading = weui.loading('提交中...');
|
|
$(this).parent('form').submit();
|
|
setTimeout(function () {
|
|
loading.hide();
|
|
weui.toast('提交成功', 3000);
|
|
}, 1500);
|
|
}
|
|
}, this.regexp);
|
|
}
|
|
}
|
|
})
|
|
});
|
|
});
|
|
} |