From 00866a5ba13de911f0f7b1182a24f4872d333a3d Mon Sep 17 00:00:00 2001 From: panda <7934952@qq.com> Date: Tue, 30 Jul 2024 17:18:02 +0800 Subject: [PATCH] add neew --- src/components/blogs/header/NavigateMenu.vue | 24 +++++++++--- src/stores/index.ts | 19 ++++++++-- src/views/blog/HomePageView.vue | 39 +++++++++++--------- 3 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/components/blogs/header/NavigateMenu.vue b/src/components/blogs/header/NavigateMenu.vue index 59cbd40..bd9b73a 100644 --- a/src/components/blogs/header/NavigateMenu.vue +++ b/src/components/blogs/header/NavigateMenu.vue @@ -2,7 +2,7 @@ @@ -16,14 +16,15 @@ import { HomeOutlined, HighlightOutlined, ProfileOutlined, CameraOutlined, Userg import type { MenuProps } from 'ant-design-vue'; import { get } from '@/tools/request'; const props = defineProps(["items", "updateCarouselVisibility"]) -const { idShow,fetchHomePageList } = homePageStore() +const { idShow,fetchHomePageList,setEmpty } = homePageStore() const { show_menu } = toRefs(idShow) const store = useContentStore(); const searchValue = ref("") const articleTitle = ref(''); const route = useRoute() -const onSearch =async (searchValue: string) => { - await fetchHomePageList(searchValue); +const isDisabled=ref(false) +const onSearch =(searchValue: string) => { + fetchHomePageList(searchValue) }; const current = ref(['home']); const items = ref([ @@ -111,7 +112,20 @@ watch( }, { immediate: true } ); - +watch(searchValue, (newValue) => { + if (newValue === "") { + fetchHomePageList(""); + + } +}); +router.beforeEach((to, _, next) => { + if (to.name !== 'home') { + isDisabled.value=true; + } else { + isDisabled.value=false; + } + next(); +}); \ No newline at end of file