File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1313 <svg-icon icon-class =" user" />
1414 </span >
1515 <el-input
16+ ref =" username"
1617 v-model =" loginForm.username"
1718 :placeholder =" $t('login.username')"
1819 name =" username"
2627 <svg-icon icon-class =" password" />
2728 </span >
2829 <el-input
30+ ref =" password"
2931 v-model =" loginForm.password"
3032 :type =" passwordType"
3133 :placeholder =" $t('login.password')"
@@ -96,7 +98,7 @@ export default {
9698 return {
9799 loginForm: {
98100 username: ' admin' ,
99- password: ' 1111111 '
101+ password: ' 111111 '
100102 },
101103 loginRules: {
102104 username: [{ required: true , trigger: ' blur' , validator: validateUsername }],
@@ -119,6 +121,13 @@ export default {
119121 created () {
120122 // window.addEventListener('hashchange', this.afterQRScan)
121123 },
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+ },
122131 destroyed () {
123132 // window.removeEventListener('hashchange', this.afterQRScan)
124133 },
@@ -129,6 +138,9 @@ export default {
129138 } else {
130139 this .passwordType = ' password'
131140 }
141+ this .$nextTick (() => {
142+ this .$refs .password .focus ()
143+ })
132144 },
133145 handleLogin () {
134146 this .$refs .loginForm .validate (valid => {
You can’t perform that action at this time.
0 commit comments