feat: new layout

This commit is contained in:
MoreStrive
2024-06-28 15:39:26 +07:00
parent ab3419bd5f
commit ad962eda86
134 changed files with 4977 additions and 2985 deletions
@@ -1,28 +1,24 @@
<script setup lang="ts">
import DynamicLayout from '~/components/dynamic-page/page-section/layouts/index.vue';
import type { PageSection } from "~/server/models/dynamic-page/index";
import DynamicLayout from "@/components/dynamic-page/page-section/layouts/index.vue";
import type { PageSection } from "@/models/cms";
const emit = defineEmits(['dropComponent', 'dropData', 'selectComponent']);
const emit = defineEmits(["dropComponent", "dropData", "selectComponent"]);
const props = defineProps<{
label?: any
layout?: string
settings?: any
content?: any
section: PageSection
}>()
label?: any;
layout?: string;
settings?: any;
content?: any;
section: PageSection;
}>();
</script>
<template>
<DynamicLayout
:layout="props.layout"
:content="props.content"
:settings="props.settings"
:section= "props.section"
/>
<DynamicLayout :layout="props.layout" :content="props.content" :settings="props.settings" :section="props.section" />
</template>
<style lang="scss" scoped>
</style>
.border-custom {
border-color: #e5e5e5 !important;
}
</style>
@@ -0,0 +1 @@
export { default as None_Section_Default } from './Default.vue'
@@ -0,0 +1,38 @@
<script lang="ts" setup>
import type { PageSection } from "@/models/cms";
import { enumPageSectionKey, enumPageSectionTemplate } from "@/definitions/enum";
import { None_Section_Default } from "./index";
const _props = defineProps<{
settings?: any;
content?: any;
section: PageSection;
}>();
const definedDynamicSection: Record<string, any> = {
[enumPageSectionTemplate[enumPageSectionKey.NONE]['NONE']]: None_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>