34 lines
769 B
Vue
34 lines
769 B
Vue
|
|
<script lang="ts" setup>
|
||
|
|
import { enumPageComponentTemplates } from "@/definitions/enum";
|
||
|
|
import { ADS_Default
|
||
|
|
} from "./index";
|
||
|
|
const _props = defineProps<{
|
||
|
|
settings: any;
|
||
|
|
component?: any;
|
||
|
|
}>();
|
||
|
|
|
||
|
|
const definedDynamicComponent: Record<string, any> = {
|
||
|
|
'DEFAULT': ADS_Default,
|
||
|
|
};
|
||
|
|
|
||
|
|
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>
|