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); } } }) }); }); }