feat: new layout
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<script lang="ts" setup>
|
||||
import { Article_Section_Default } from "./index";
|
||||
import type { PageSection } from "@/models/cms";
|
||||
import { enumPageSectionKey, enumPageSectionTemplate } from "@/definitions/enum";
|
||||
|
||||
const _props = defineProps<{
|
||||
settings?: any;
|
||||
content?: any;
|
||||
section: PageSection;
|
||||
}>();
|
||||
|
||||
const definedDynamicSection: Record<string, any> = {
|
||||
[enumPageSectionTemplate[enumPageSectionKey.ARTICLE]['DEFAULT']]: Article_Section_Default,
|
||||
};
|
||||
|
||||
const getCurrentSection = computed(() => _props.settings.template);
|
||||
|
||||
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="definedDynamicSection[getCurrentSection]" v-bind="{ ...GET_PROPS(), section: _props.section, content: _props.content, settings: _props.settings }">
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
Reference in New Issue
Block a user