From 0294a72b337faaa7cfaf1d95f34745806aa5ffa3 Mon Sep 17 00:00:00 2001 From: shangTou Date: Wed, 9 Oct 2019 03:32:26 +0800 Subject: [PATCH] optimize checkCapslock method --- src/views/login/index.vue | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5fb3f6e3..3868a849 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -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') {