1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-09-06 09:34:27 +08:00

首次登陆获取焦点

This commit is contained in:
马云海 mayunhai () 2019-03-29 10:39:09 +08:00
parent 6af0329f1e
commit 91a9935947

View File

@ -13,6 +13,7 @@
<svg-icon icon-class="user" />
</span>
<el-input
ref="usernameInput"
v-model="loginForm.username"
:placeholder="$t('login.username')"
name="username"
@ -26,6 +27,7 @@
<svg-icon icon-class="password" />
</span>
<el-input
ref="passwordInput"
v-model="loginForm.password"
:type="passwordType"
:placeholder="$t('login.password')"
@ -119,6 +121,13 @@ export default {
created() {
// window.addEventListener('hashchange', this.afterQRScan)
},
mounted() {
if (this.loginForm.username === '') {
this.$refs.usernameInput.focus()
} else if (this.loginForm.password === '') {
this.$refs.passwordInput.focus()
}
},
destroyed() {
// window.removeEventListener('hashchange', this.afterQRScan)
},