base zone components and type refinements
This commit is contained in:
parent
9d96e3a6dc
commit
5c56af0dad
38 changed files with 323 additions and 54 deletions
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<NuxtLayout name="default">
|
||||
<NotFound v-if="data.length == 0" />
|
||||
<ContentBuilder v-else class="min-h-[calc(100vh-9rem)] w-full" />
|
||||
<NotFound v-if="active_page_id == ''" />
|
||||
<ContentBuilder v-else class="min-h-[calc(100vh-9rem)] w-full" :hero="hero" :content="content" />
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
|
||||
|
@ -18,7 +18,7 @@ const { findOne } = useStrapi();
|
|||
const { data: global } = await useAsyncData("global", () => findOne<Global>("global"));
|
||||
const {
|
||||
navbar: { navbar_items },
|
||||
} = global.value?.data as unknown as Global;
|
||||
} = global.value?.data ?? ({} as Global);
|
||||
|
||||
const navbar_sub_items = computed(() => {
|
||||
return navbar_items.find((ni) => ni.URL == params[0])?.navbar_sub_items ?? [];
|
||||
|
@ -31,14 +31,21 @@ const active_sub_item = computed(() => {
|
|||
return navbar_sub_items.value.find((si) => si.URL == params[1])?.page;
|
||||
});
|
||||
const active_page_id = computed<string>(() => {
|
||||
return active_sub_item.value?.slug ?? active_item.value?.slug ?? "";
|
||||
return active_sub_item.value?.documentId ?? active_item.value?.documentId ?? "";
|
||||
});
|
||||
|
||||
const { data: pages } = await useAsyncData("pages", () =>
|
||||
findOne<Array<Page>>("pages", {
|
||||
populate: "*",
|
||||
filters: { slug: active_page_id.value },
|
||||
findOne<Page>("pages", active_page_id.value, {
|
||||
populate: {
|
||||
populate: "*",
|
||||
content: {
|
||||
populate: "*",
|
||||
},
|
||||
hero: {
|
||||
populate: "*",
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
const data = pages.value?.data as unknown as Array<Page>;
|
||||
const { content, hero } = pages.value?.data ?? {};
|
||||
</script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<NuxtLayout name="landing">
|
||||
<ContentBuilder class="min-h-[calc(100vh-9rem)] w-full" />
|
||||
<ContentBuilder class="min-h-[calc(100vh-9rem)] w-full" :content="content" />
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
|
||||
|
@ -10,5 +10,5 @@ import type Homepage from "../types/single/homepage";
|
|||
const { findOne } = useStrapi();
|
||||
|
||||
const { data: homepage } = await useAsyncData("homepage", () => findOne<Homepage>("homepage"));
|
||||
const { content } = homepage.value?.data as unknown as Homepage;
|
||||
const { content } = homepage.value?.data ?? {};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue