Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
optimize checkCapslock method
  • Loading branch information
shangTou committed Oct 8, 2019
commit 0294a72b337faaa7cfaf1d95f34745806aa5ffa3
11 changes: 1 addition & 10 deletions src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,7 @@ export default {
},
methods: {
checkCapslock({ shiftKey, key } = {}) {
if (key && key.length === 1) {
if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) {
this.capsTooltip = true
} else {
this.capsTooltip = false
}
}
if (key === 'CapsLock' && this.capsTooltip === true) {
this.capsTooltip = false
}
this.capsTooltip = key && key.length === 1 && ((shiftKey && (key >= 'A' && key <= 'Z')) || (!shiftKey && (key >= 'A' && key <= 'Z')))
},
showPwd() {
if (this.passwordType === 'password') {
Expand Down