diff --git a/app.vue b/app.vue index bc375a7..6cd9e5a 100644 --- a/app.vue +++ b/app.vue @@ -2,8 +2,26 @@ import type { ParsedContent } from '@nuxt/content/dist/runtime/types' const { seo } = useAppConfig() +const route = useRoute() + +const { data: navigation, refresh: refreshNavigation } = await useAsyncData('navigation', () => fetchContentNavigation(), { + transform: (data) => { + const result = [] + + data.forEach((item) => { + if (item.title.toLowerCase() === route.fullPath.split('/')[1]) { + if (item.children) { + item.children.forEach((child) => { + result.push(child) + }) + } + } + }) + + return result + } +}) -const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation()) const { data: files } = useLazyFetch('/api/search.json', { default: () => [], server: false @@ -29,7 +47,7 @@ useSeoMeta({ twitterCard: 'summary_large_image' }) -provide('navigation', navigation) +provide('navigation', { navigation, refreshNavigation })