首次登陆获取焦点

pull/1798/head
马云海 mayunhai () 2019-03-29 10:39:09 +08:00
parent 6af0329f1e
commit 91a9935947
1 changed files with 9 additions and 0 deletions

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