perf: optimize checkCapslock method (#2635)
* optimize checkCapslock method * update Co-authored-by: 花裤衩 <panfree23@gmail.com>
This commit is contained in:
		@@ -138,17 +138,9 @@ 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
 | 
			
		||||
      }
 | 
			
		||||
    checkCapslock(e) {
 | 
			
		||||
      const { key } = e
 | 
			
		||||
      this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
 | 
			
		||||
    },
 | 
			
		||||
    showPwd() {
 | 
			
		||||
      if (this.passwordType === 'password') {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user