From b44e2a98492432ebf0d243a6275d20a71a57bead Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 8 Apr 2024 15:03:35 +0200 Subject: [PATCH] fix: router navigation, close #303, close #300, close #301 --- src/components/IconDetail.vue | 1 - src/components/IconSet.vue | 4 +--- src/hooks/search.ts | 8 -------- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/components/IconDetail.vue b/src/components/IconDetail.vue index 16fd7f74..1d1ebbdb 100644 --- a/src/components/IconDetail.vue +++ b/src/components/IconDetail.vue @@ -145,7 +145,6 @@ const collection = computed(() => { {{ collection.name }} diff --git a/src/components/IconSet.vue b/src/components/IconSet.vue index fd3882a4..253419a3 100755 --- a/src/components/IconSet.vue +++ b/src/components/IconSet.vue @@ -116,9 +116,7 @@ function focusSearch() { onMounted(focusSearch) watch(router.currentRoute, focusSearch, { immediate: true }) -router.afterEach((to) => { - if (to.path === '/') - search.value = '' +router.afterEach(() => { focusSearch() }) diff --git a/src/hooks/search.ts b/src/hooks/search.ts index 8cc4692f..09768a6a 100644 --- a/src/hooks/search.ts +++ b/src/hooks/search.ts @@ -129,14 +129,6 @@ export function useSearch(collection: Ref) { debouncedSearch() }) - watch( - collection, - () => { - category.value = '' - variant.value = '' - }, - ) - return { collection, search,