update 降低搜索速率

This commit is contained in:
2021-05-11 10:04:45 +08:00
parent 86a398c237
commit 89bed3e0ee

View File

@@ -10,6 +10,8 @@ export default {
return { return {
searchText: '', searchText: '',
searchResult: [], searchResult: [],
timer: null
}; };
}, },
@@ -44,6 +46,14 @@ export default {
onSearch(value) { onSearch(value) {
clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.doSearch(value)
}, 300)
},
doSearch(value) {
this.searchText = value this.searchText = value
const menus = this.$_.concat.apply(this, this.$_.cloneDeep(this.menus.map(p => p.menu))) const menus = this.$_.concat.apply(this, this.$_.cloneDeep(this.menus.map(p => p.menu)))