diff --git a/src/views/home/aside/comp/AdvanceFilter.vue b/src/views/home/aside/comp/AdvanceFilter.vue index 74f5f4f..5308db4 100644 --- a/src/views/home/aside/comp/AdvanceFilter.vue +++ b/src/views/home/aside/comp/AdvanceFilter.vue @@ -27,7 +27,7 @@ const emit = defineEmits<{ const data = ref([]); const unData = ref([]); -let loading = false; +const loading = ref(false); const canloadMore = true; const el = ref(null); const popover = ref(null); @@ -74,12 +74,12 @@ useInfiniteScroll( }, { distance: 10, interval: 300, canLoadMore: () => false } ); -const showClick = () => { - inputHandler(""); +const showClick =async () => { + getSearchedList('') }; async function loadMore() { - if (loading || el.value == null) return; + if (loading.value || el.value == null) return; const more = await featchList(); @@ -89,7 +89,7 @@ async function loadMore() { } async function featchList() { - loading = true; + loading.value = true; try { const searchParam: FilterSearchParam = { search_searchname: { value: keyword.value, op: "like", type: "string" }, @@ -103,7 +103,7 @@ async function featchList() { } catch (error) { return []; } finally { - loading = false; + loading.value = false; } } @@ -148,6 +148,10 @@ function selectHandler(item: FilterEntity) { } const inputHandler = debounce((word) => { + getSearchedList(word) +}, 300); + +function getSearchedList(word) { if (word) { pagination.pageSize = 300; } else { @@ -172,7 +176,7 @@ const inputHandler = debounce((word) => { (a, b) => Number((a as any).reorder) - Number((b as any).reorder) ); }); -}, 300); +} function favoriteHandler(event: MouseEvent, item: any) { event.stopImmediatePropagation();