fix: 修复当存在遮罩层时按下 / 也会聚焦的 bug

This commit is contained in:
zhaojisen
2024-05-28 16:14:02 +08:00
committed by 老广
parent a12e17b39c
commit b46fc915f3

View File

@@ -346,8 +346,9 @@ export default {
this.$refs.SearchInput.focus()
},
handleKeyUp(event) {
// 检查按下的键是否是"T"键
if (event.key === '/' || event.key === 't') {
// 当目标对象为一个 length 为 0 的伪数组时表明此时是在全局情况下调用
// 若存在遮罩层等组件在调用时,其 length 将会为 1
if (event.target.classList.length === 0 && event.key === '/') {
this.$refs.SearchInput.focus()
this.suffixIcon = 'el-icon-search'
this.isFocus = true