mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-09-08 21:01:22 +08:00
refine
This commit is contained in:
parent
91a9935947
commit
37f6f9e177
@ -13,7 +13,7 @@
|
|||||||
<svg-icon icon-class="user" />
|
<svg-icon icon-class="user" />
|
||||||
</span>
|
</span>
|
||||||
<el-input
|
<el-input
|
||||||
ref="usernameInput"
|
ref="username"
|
||||||
v-model="loginForm.username"
|
v-model="loginForm.username"
|
||||||
:placeholder="$t('login.username')"
|
:placeholder="$t('login.username')"
|
||||||
name="username"
|
name="username"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<svg-icon icon-class="password" />
|
<svg-icon icon-class="password" />
|
||||||
</span>
|
</span>
|
||||||
<el-input
|
<el-input
|
||||||
ref="passwordInput"
|
ref="password"
|
||||||
v-model="loginForm.password"
|
v-model="loginForm.password"
|
||||||
:type="passwordType"
|
:type="passwordType"
|
||||||
:placeholder="$t('login.password')"
|
:placeholder="$t('login.password')"
|
||||||
@ -98,7 +98,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
password: '1111111'
|
password: '111111'
|
||||||
},
|
},
|
||||||
loginRules: {
|
loginRules: {
|
||||||
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
|
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
|
||||||
@ -123,9 +123,9 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.loginForm.username === '') {
|
if (this.loginForm.username === '') {
|
||||||
this.$refs.usernameInput.focus()
|
this.$refs.username.focus()
|
||||||
} else if (this.loginForm.password === '') {
|
} else if (this.loginForm.password === '') {
|
||||||
this.$refs.passwordInput.focus()
|
this.$refs.password.focus()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
@ -138,6 +138,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.passwordType = 'password'
|
this.passwordType = 'password'
|
||||||
}
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.password.focus()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
handleLogin() {
|
handleLogin() {
|
||||||
this.$refs.loginForm.validate(valid => {
|
this.$refs.loginForm.validate(valid => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user