minhnt-dev: only ssr
This commit is contained in:
+1
-17
@@ -1,6 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import _cloneDeep from 'lodash/cloneDeep';
|
||||
|
||||
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';
|
||||
@@ -11,19 +9,7 @@ const store = reactive({
|
||||
dynamicPage: useDynamicPageStore(),
|
||||
});
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', ''));
|
||||
} catch (error) {
|
||||
console.error("Error fetching data:", error);
|
||||
}
|
||||
})();
|
||||
|
||||
watch(currentPage, () => {
|
||||
store.dynamicPage.setSectionPublished();
|
||||
store.dynamicPage.setComponentPublished()
|
||||
}, { deep: true })
|
||||
|
||||
await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', '')))
|
||||
useHead({
|
||||
title: 'Trang chủ'
|
||||
})
|
||||
@@ -32,7 +18,6 @@ useHead({
|
||||
<template>
|
||||
<main class="h-screen" v-if="currentPage">
|
||||
<DynamicTemplate :settings="currentPage.settings">
|
||||
<template v-if="sectionPublished && sectionPublished.length > 0">
|
||||
<DynamicSection
|
||||
v-for="(section, index) in sectionPublished"
|
||||
:key="index"
|
||||
@@ -40,7 +25,6 @@ useHead({
|
||||
:content="section.content ? JSON.parse(section.content) : null"
|
||||
:section="section"
|
||||
/>
|
||||
</template>
|
||||
</DynamicTemplate>
|
||||
</main>
|
||||
</template>
|
||||
Reference in New Issue
Block a user