fix(仪表板): 下拉框模糊搜索逻辑错误
This commit is contained in:
parent
b71c821b7e
commit
d51cf1d55e
@ -40,6 +40,10 @@ export default {
|
||||
value: {
|
||||
type: [String, Number, Array],
|
||||
default: ''
|
||||
},
|
||||
keyWord: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -80,7 +84,16 @@ export default {
|
||||
this.init()
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
keyWord(val, old) {
|
||||
if(val === old) return
|
||||
const results = val ? this.list.filter(item => item.text.includes(val)) : null
|
||||
this.resetList(results)
|
||||
this.reCacularHeight()
|
||||
this.$nextTick(() => {
|
||||
this.callback()
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.resetList()
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
:popper-append-to-body="inScreen"
|
||||
:size="size"
|
||||
:filterable="true"
|
||||
:filter-method="filterMethod"
|
||||
:key-word="keyWord"
|
||||
popper-class="coustom-de-select"
|
||||
:list="datas"
|
||||
@change="changeValue"
|
||||
@ -71,7 +73,8 @@ export default {
|
||||
show: true,
|
||||
value: null,
|
||||
datas: [],
|
||||
onFocus: false
|
||||
onFocus: false,
|
||||
keyWord: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -203,6 +206,9 @@ export default {
|
||||
bus.$off('reset-default-value', this.resetDefaultValue)
|
||||
},
|
||||
methods: {
|
||||
filterMethod(key) {
|
||||
this.keyWord = key
|
||||
},
|
||||
onScroll() {
|
||||
if (this.onFocus) {
|
||||
this.$refs.deSelect.blur()
|
||||
@ -215,7 +221,7 @@ export default {
|
||||
}
|
||||
},
|
||||
onBlur() {
|
||||
this.onFocus = false
|
||||
// this.onFocus = false
|
||||
},
|
||||
handleElTagStyle() {
|
||||
setTimeout(() => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user