feat(editor): 搜索防抖

This commit is contained in:
roymondchen 2023-10-20 16:56:06 +08:00
parent 04025682d5
commit d3171f4c69

View File

@ -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>