From 630bdd2ca3562b988853752a39fb25cd2d959c1f Mon Sep 17 00:00:00 2001 From: WRXinYue Date: Sun, 5 Jan 2025 21:48:36 +0800 Subject: [PATCH] fix: run fetchFuseListData only on the client --- theme/components/layouts/SakuraSearchLayout.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/theme/components/layouts/SakuraSearchLayout.vue b/theme/components/layouts/SakuraSearchLayout.vue index 96b84d8d..9dbe4201 100644 --- a/theme/components/layouts/SakuraSearchLayout.vue +++ b/theme/components/layouts/SakuraSearchLayout.vue @@ -2,6 +2,7 @@ import { useFuseSearch } from 'valaxy' import { ref, watch } from 'vue' import { useRoute } from 'vue-router' +import { isClient } from '@vueuse/core' const input = ref() @@ -9,7 +10,9 @@ const { results, fetchFuseListData } = useFuseSearch(input) const route = useRoute() watch(() => route.query.q as string, (query) => { - fetchFuseListData() + if (isClient) + fetchFuseListData() + input.value = query || '' }, { immediate: true }) @@ -61,7 +64,7 @@ watch(() => route.query.q as string, (query) => {
- +