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 { Default_Pagination } from "./index";
|
|
|
|
|
|
2024-06-12 17:17:49 +07:00
|
|
|
const _props = defineProps<{
|
|
|
|
|
settings: any;
|
|
|
|
|
component?: any;
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const definedDynamicComponent: Record<string, any> = {
|
2024-06-28 15:39:26 +07:00
|
|
|
[enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.SECTION]['ARTICLE']}`]['ARTICLE_SECTION_DEFAULT']]: Default_Pagination,
|
2024-06-12 17:17:49 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getCurrentComponent = computed(() => `${_props.settings.layout}`);
|
2024-06-28 15:39:26 +07:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-06-28 15:39:26 +07:00
|
|
|
<component
|
|
|
|
|
:is="definedDynamicComponent[getCurrentComponent]"
|
|
|
|
|
v-bind="{ ...GET_PROPS(), component: _props.component, settings: _props.settings }"
|
|
|
|
|
/>
|
2024-06-12 17:17:49 +07:00
|
|
|
</template>
|