diff --git a/src/components/Table/TagSearch/index.vue b/src/components/Table/TagSearch/index.vue
index 9998e6b58..660914984 100644
--- a/src/components/Table/TagSearch/index.vue
+++ b/src/components/Table/TagSearch/index.vue
@@ -29,13 +29,14 @@
:placeholder="placeholder"
:validate-event="false"
class="search-input"
- suffix-icon="el-icon-search"
+ :suffix-icon="suffixIcon"
@blur="handleBlur"
@change="handleConfirm"
- @focus="focus = true"
+ @focus="handleFocus"
@keyup.enter.native="handleConfirm"
@keyup.delete.native="handleDelete"
/>
+ t
@@ -67,10 +68,12 @@ export default {
filterKey: '',
filterValue: '',
valueLabel: '',
+ suffixIcon: '',
emptyCount: 0,
filterTags: this.default || {},
focus: false,
- showCascade: true
+ showCascade: true,
+ isFocus: false
}
},
computed: {
@@ -134,9 +137,22 @@ export default {
}
}
},
+ mounted() {
+ document.addEventListener('keyup', this.handleKeyUp)
+ },
+ beforeDestroy() {
+ document.removeEventListener('keyup', this.handleKeyUp)
+ },
methods: {
+ handleFocus() {
+ this.focus = true
+ this.isFocus = true
+ this.suffixIcon = 'el-icon-search'
+ },
handleBlur() {
this.focus = false
+ this.isFocus = false
+ this.suffixIcon = ''
this.$emit('blur')
},
// 获取url中的查询条件,判断是不是包含在当前查询条件里
@@ -329,6 +345,14 @@ export default {
this.filterValue = v.value
this.$refs.SearchInput.focus()
},
+ handleKeyUp(event) {
+ // 检查按下的键是否是"T"键
+ if (event.key === 'T' || event.key === 't') {
+ this.$refs.SearchInput.focus()
+ this.suffixIcon = 'el-icon-search'
+ this.isFocus = true
+ }
+ },
// 删除查询条件时改变url
checkUrlFields(evt) {
let newQuery = _.omit(this.$route.query, evt)
@@ -347,11 +371,16 @@ export default {