diff --git a/Web/src/views/main/_layout/header/search.js b/Web/src/views/main/_layout/header/search.js index cae9bd6..043f2f8 100644 --- a/Web/src/views/main/_layout/header/search.js +++ b/Web/src/views/main/_layout/header/search.js @@ -10,6 +10,8 @@ export default { return { searchText: '', searchResult: [], + + timer: null }; }, @@ -44,6 +46,14 @@ export default { onSearch(value) { + clearTimeout(this.timer) + + this.timer = setTimeout(() => { + this.doSearch(value) + }, 300) + }, + + doSearch(value) { this.searchText = value const menus = this.$_.concat.apply(this, this.$_.cloneDeep(this.menus.map(p => p.menu)))