Files
NSG_PORTAL_V2/components/dynamic-page/page-component/templates/collections/index.vue
T

36 lines
806 B
Vue
Raw Normal View History

<script lang="ts" setup>
import {
Collection_Article
} from "./index";
const _props = defineProps<{
settings: any;
component?: any;
2024-06-25 09:08:44 +07:00
content?: any
}>();
const definedDynamicComponent: Record<string, any> = {
'TYPE:Article-LAYOUT:vertical-DATA:HORIZONTAL': Collection_Article,
};
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;
}
};
});
2024-06-25 09:08:44 +07:00
</script>
<template>
2024-06-25 09:08:44 +07:00
<component :is="definedDynamicComponent[getCurrentComponent]" v-bind="{...GET_PROPS(), content: _props.content}" />
</template>