Skip to content

Commit 0294a72

Browse files
committed
optimize checkCapslock method
1 parent 197948d commit 0294a72

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/views/login/index.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,7 @@ export default {
139139
},
140140
methods: {
141141
checkCapslock({ shiftKey, key } = {}) {
142-
if (key && key.length === 1) {
143-
if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) {
144-
this.capsTooltip = true
145-
} else {
146-
this.capsTooltip = false
147-
}
148-
}
149-
if (key === 'CapsLock' && this.capsTooltip === true) {
150-
this.capsTooltip = false
151-
}
142+
this.capsTooltip = key && key.length === 1 && ((shiftKey && (key >= 'A' && key <= 'Z')) || (!shiftKey && (key >= 'A' && key <= 'Z')))
152143
},
153144
showPwd() {
154145
if (this.passwordType === 'password') {

0 commit comments

Comments
 (0)