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