2024-05-30 18:06:50 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import DynamicTemplate from "~/components/dynamic-page/page/templates/index.vue";
|
|
|
|
|
import DynamicSection from "~/components/dynamic-page/page-section/templates/index.vue";
|
|
|
|
|
import { useDynamicPageStore } from '~/stores/dynamic-page';
|
|
|
|
|
const { currentPage, sectionPublished, componentPublished } = storeToRefs(useDynamicPageStore());
|
|
|
|
|
|
2024-05-31 12:49:28 +07:00
|
|
|
const route = useRoute();
|
2024-05-30 18:06:50 +07:00
|
|
|
const store = reactive({
|
|
|
|
|
dynamicPage: useDynamicPageStore(),
|
|
|
|
|
});
|
2024-05-31 12:49:28 +07:00
|
|
|
|
2024-06-21 09:56:34 +07:00
|
|
|
await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', '')))
|
2024-05-30 21:32:51 +07:00
|
|
|
useHead({
|
|
|
|
|
title: 'Trang chủ'
|
|
|
|
|
})
|
2024-05-30 18:06:50 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<main class="h-screen" v-if="currentPage">
|
|
|
|
|
<DynamicTemplate :settings="currentPage.settings">
|
|
|
|
|
<DynamicSection
|
|
|
|
|
v-for="(section, index) in sectionPublished"
|
|
|
|
|
:key="index"
|
|
|
|
|
:settings="section.settings"
|
|
|
|
|
:content="section.content ? JSON.parse(section.content) : null"
|
|
|
|
|
:section="section"
|
|
|
|
|
/>
|
|
|
|
|
</DynamicTemplate>
|
|
|
|
|
</main>
|
|
|
|
|
</template>
|