Skip to content

Commit

Permalink
feat(editor): 搜索防抖
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Oct 20, 2023
1 parent 0402568 commit d3171f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/editor/src/components/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ const emit = defineEmits(['search']);
const filterText = ref('');
let timer: NodeJS.Timeout | null = null;
const filterTextChangeHandler = () => {
emit('search', filterText.value);
timer && clearTimeout(timer);
timer = setTimeout(() => {
emit('search', filterText.value);
}, 300);
};
</script>

0 comments on commit d3171f4

Please sign in to comment.