From 3231a995aa1bfe71951de9ace67966338d2d8a8b Mon Sep 17 00:00:00 2001 From: shangtou Date: Fri, 9 Aug 2019 17:07:30 +0800 Subject: [PATCH] optimize views/login/index.vue 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..f259a6c8 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') {