thainv-dev: page chi tiết
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<script lang="ts" setup>
|
||||
import { enumPageComponentTemplates } from "@/definitions/enum";
|
||||
// import { Default_Breadcrumb, Comment, Podcast, Video, Article_Detail_Default, ADS_Default, Article_Button, Article_Detail_Infographics, Article_Detail_Emagazine} from "./index";
|
||||
import { Article_Button, Article_Detail_Emagazine, Article_Detail_Default, Article_Detail_Infographics, Default_Breadcrumb} from "./index";
|
||||
const _props = defineProps<{
|
||||
settings: any;
|
||||
component?: any;
|
||||
}>();
|
||||
|
||||
const definedDynamicComponent: Record<string, any> = {
|
||||
'BREADCRUM_DEFAULT': Default_Breadcrumb,
|
||||
'ARTICLE_DETAIL_DEFAULT': Article_Detail_Default,
|
||||
'ARTICLE_DETAIL_INFOGRAPHICS': Article_Detail_Infographics,
|
||||
'ARTICLE_DETAIL_EMAGAZINE': Article_Detail_Emagazine,
|
||||
// 'ADS_DEFAULT': ADS_Default,
|
||||
'ARTICLE_BUTTON': Article_Button,
|
||||
// COMMENT: Comment,
|
||||
// POCAST: Podcast,
|
||||
// VIDEO: Video
|
||||
};
|
||||
|
||||
const getCurrentComponent = computed(() => `${_props.settings.layout}`);
|
||||
|
||||
const GET_PROPS = computed(() => {
|
||||
return () => {
|
||||
let props: any = {};
|
||||
if (_props.settings) {
|
||||
for (const [key, value] of Object.entries(_props.settings)) {
|
||||
props = {
|
||||
...props,
|
||||
[key]: value,
|
||||
};
|
||||
}
|
||||
return props;
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component :is="definedDynamicComponent[getCurrentComponent]" v-bind="GET_PROPS()" />
|
||||
</template>
|
||||
Reference in New Issue
Block a user