File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 13
13
<svg-icon icon-class =" user" />
14
14
</span >
15
15
<el-input
16
+ ref =" username"
16
17
v-model =" loginForm.username"
17
18
:placeholder =" $t('login.username')"
18
19
name =" username"
26
27
<svg-icon icon-class =" password" />
27
28
</span >
28
29
<el-input
30
+ ref =" password"
29
31
v-model =" loginForm.password"
30
32
:type =" passwordType"
31
33
:placeholder =" $t('login.password')"
@@ -96,7 +98,7 @@ export default {
96
98
return {
97
99
loginForm: {
98
100
username: ' admin' ,
99
- password: ' 1111111 '
101
+ password: ' 111111 '
100
102
},
101
103
loginRules: {
102
104
username: [{ required: true , trigger: ' blur' , validator: validateUsername }],
@@ -119,6 +121,13 @@ export default {
119
121
created () {
120
122
// window.addEventListener('hashchange', this.afterQRScan)
121
123
},
124
+ mounted () {
125
+ if (this .loginForm .username === ' ' ) {
126
+ this .$refs .username .focus ()
127
+ } else if (this .loginForm .password === ' ' ) {
128
+ this .$refs .password .focus ()
129
+ }
130
+ },
122
131
destroyed () {
123
132
// window.removeEventListener('hashchange', this.afterQRScan)
124
133
},
@@ -129,6 +138,9 @@ export default {
129
138
} else {
130
139
this .passwordType = ' password'
131
140
}
141
+ this .$nextTick (() => {
142
+ this .$refs .password .focus ()
143
+ })
132
144
},
133
145
handleLogin () {
134
146
this .$refs .loginForm .validate (valid => {
You can’t perform that action at this time.
0 commit comments