perf: optimize checkCapslock method (#2635)
* optimize checkCapslock method * update Co-authored-by: 花裤衩 <panfree23@gmail.com>
This commit is contained in:
parent
93e01926e3
commit
ea27da43b7
|
@ -146,17 +146,9 @@ export default {
|
||||||
// window.removeEventListener('storage', this.afterQRScan)
|
// window.removeEventListener('storage', this.afterQRScan)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkCapslock({ shiftKey, key } = {}) {
|
checkCapslock(e) {
|
||||||
if (key && key.length === 1) {
|
const { key } = e
|
||||||
if (shiftKey && (key >= 'a' && key <= 'z') || !shiftKey && (key >= 'A' && key <= 'Z')) {
|
this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
|
||||||
this.capsTooltip = true
|
|
||||||
} else {
|
|
||||||
this.capsTooltip = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (key === 'CapsLock' && this.capsTooltip === true) {
|
|
||||||
this.capsTooltip = false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
showPwd() {
|
showPwd() {
|
||||||
if (this.passwordType === 'password') {
|
if (this.passwordType === 'password') {
|
||||||
|
|
Loading…
Reference in New Issue