From bd1579c80e9034ec754b5223002bee2993f00a64 Mon Sep 17 00:00:00 2001 From: Pan Date: Mon, 8 Apr 2019 14:09:06 +0800 Subject: [PATCH] refine --- src/views/login/index.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 8d571bff..b9cba35f 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -23,7 +23,7 @@ /> - + @@ -37,7 +37,7 @@ name="password" auto-complete="on" @keyup.native="checkCapslock" - @blur="visible = false" + @blur="capsTooltip = false" @keyup.enter.native="handleLogin" /> @@ -111,7 +111,7 @@ export default { password: [{ required: true, trigger: 'blur', validator: validatePassword }] }, passwordType: 'password', - visible: false, + capsTooltip: false, loading: false, showDialog: false, redirect: undefined @@ -140,15 +140,15 @@ export default { }, methods: { checkCapslock({ shiftKey, key } = {}) { - if (((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z')) && key.length === 1) { + if (key && key.length === 1) { if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) { - this.visible = true + this.capsTooltip = true } else { - this.visible = false + this.capsTooltip = false } } - if (key === 'CapsLock' && this.visible === true) { - this.visible = false + if (key === 'CapsLock' && this.capsTooltip === true) { + this.capsTooltip = false } }, showPwd() {