From 0358667a736cf179baaf23a466f053df1d819ece Mon Sep 17 00:00:00 2001 From: MaYuanhai <414199639@qq.com> Date: Mon, 8 Apr 2019 14:13:07 +0800 Subject: [PATCH] perf[Login]: password input add caps tooltip (#1845) --- src/views/login/index.vue | 53 ++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 979cfcb4..b9cba35f 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -23,24 +23,28 @@ /> - - - - - - - - - + + + + + + + + + + + {{ $t('login.logIn') }} @@ -107,6 +111,7 @@ export default { password: [{ required: true, trigger: 'blur', validator: validatePassword }] }, passwordType: 'password', + capsTooltip: false, loading: false, showDialog: false, redirect: undefined @@ -134,6 +139,18 @@ export default { // window.removeEventListener('storage', this.afterQRScan) }, 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 + } + }, showPwd() { if (this.passwordType === 'password') { this.passwordType = ''