2024-06-12 17:17:49 +07:00
|
|
|
<script lang="ts" setup>
|
2024-06-28 15:39:26 +07:00
|
|
|
import { enumPageComponentTemplate, enumPageComponentKey, enumPageComponentLayouts } from "@/definitions/enum";
|
|
|
|
|
import { Article_Collection } from "./index";
|
|
|
|
|
|
2024-06-12 17:17:49 +07:00
|
|
|
const _props = defineProps<{
|
|
|
|
|
settings: any;
|
|
|
|
|
component?: any;
|
2024-06-28 15:39:26 +07:00
|
|
|
content?: any;
|
2024-06-12 17:17:49 +07:00
|
|
|
}>();
|
|
|
|
|
const definedDynamicComponent: Record<string, any> = {
|
2024-06-28 15:39:26 +07:00
|
|
|
[enumPageComponentTemplate[enumPageComponentKey.COLLECTION]["ARTICLE"]]: Article_Collection,
|
2024-06-12 17:17:49 +07:00
|
|
|
};
|
|
|
|
|
|
2024-06-28 15:39:26 +07:00
|
|
|
const getCurrentComponent = computed(() => _props.settings.template);
|
2024-06-12 17:17:49 +07:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-06-25 09:08:44 +07:00
|
|
|
|
2024-06-12 17:17:49 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-06-28 15:39:26 +07:00
|
|
|
<component :is="definedDynamicComponent[getCurrentComponent]" v-bind="{ ...GET_PROPS(), component: _props.component, settings: _props.settings, content: _props.content }" />
|
2024-06-12 17:17:49 +07:00
|
|
|
</template>
|