minhnt-dev: oonly ssr fix
This commit is contained in:
+8
-5
@@ -3,14 +3,17 @@ import ADSDefault from '@/assets/images/ads.jpg'
|
||||
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());
|
||||
|
||||
const route = useRoute();
|
||||
const store = reactive({
|
||||
dynamicPage: useDynamicPageStore(),
|
||||
});
|
||||
|
||||
await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', '')))
|
||||
const { data } = await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', '')))
|
||||
const asycnCurrentPage = data.value.currentPage;
|
||||
const asycnSectionPublished = data.value.sectionPublished;
|
||||
const asycnComponentPublished = data.value.componentPublished;
|
||||
|
||||
useHead({
|
||||
title: () => 'Trang chủ',
|
||||
description: () => 'Với công nghệ đột phá và giải pháp sáng tạo, Vpress sẽ là đối tác tin cậy của các tòa soạn báo, cùng nhau kiến tạo nên những giá trị bền vững trong kỷ nguyên chuyển đổi số báo chí.',
|
||||
@@ -22,10 +25,10 @@ useHead({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="h-screen" v-if="currentPage">
|
||||
<DynamicTemplate :settings="currentPage.settings">
|
||||
<main class="h-screen" v-if="asycnCurrentPage">
|
||||
<DynamicTemplate :settings="asycnCurrentPage.settings">
|
||||
<DynamicSection
|
||||
v-for="(section, index) in sectionPublished"
|
||||
v-for="(section, index) in asycnSectionPublished"
|
||||
:key="index"
|
||||
:settings="section.settings"
|
||||
:content="section.content ? JSON.parse(section.content) : null"
|
||||
|
||||
Reference in New Issue
Block a user