2024-06-17 11:48:00 +07:00
|
|
|
<script setup lang="ts">
|
2024-06-28 15:39:26 +07:00
|
|
|
import { enumPageComponentLayouts, enumPageComponentTemplate, enumPageComponentKey } from "@/definitions/enum";
|
2024-06-17 11:48:00 +07:00
|
|
|
import DynamicComponent from "~/components/dynamic-page/page-component/templates/index.vue";
|
|
|
|
|
import { useDynamicPageStore } from '~/stores/dynamic-page';
|
|
|
|
|
const { currentPage } = storeToRefs(useDynamicPageStore());
|
|
|
|
|
const props = defineProps<{
|
2024-07-05 10:39:07 +07:00
|
|
|
type?: any; // [TOP_NAVIGATION, BOTTOM_NAVIGATION]
|
2024-06-17 11:48:00 +07:00
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const defineTypeRecusive = {
|
2024-07-01 16:04:16 +07:00
|
|
|
TOP_NAVIGATION: enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['TOP']}`]['NAVIGATION_TOP_DEFAULT'],
|
|
|
|
|
BOTTOM_NAVIGATION: enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['BOTTOM']}`]['NAVIGATION_BOTTOM_DEFAULT'],
|
2024-06-17 11:48:00 +07:00
|
|
|
};
|
|
|
|
|
|
2024-07-01 16:04:16 +07:00
|
|
|
const findDataPosition = computed<any>(() => {
|
2024-06-17 11:48:00 +07:00
|
|
|
let result = {};
|
|
|
|
|
switch (props.type) {
|
|
|
|
|
case defineTypeRecusive.TOP_NAVIGATION:
|
|
|
|
|
result = currentPage.value.components && currentPage.value.components.find((component: any) => {
|
2024-06-28 15:39:26 +07:00
|
|
|
return component.taxonomy === enumPageComponentKey.NAVIGATION && component.settings?.layout === defineTypeRecusive.TOP_NAVIGATION
|
2024-06-17 11:48:00 +07:00
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case defineTypeRecusive.BOTTOM_NAVIGATION:
|
|
|
|
|
result = currentPage.value.components && currentPage.value.components.find((component: any) => {
|
2024-06-28 15:39:26 +07:00
|
|
|
return component.taxonomy === enumPageComponentKey.NAVIGATION && component.settings?.layout === defineTypeRecusive.BOTTOM_NAVIGATION
|
2024-06-17 11:48:00 +07:00
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
result = {};
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<DynamicComponent
|
|
|
|
|
v-if="findDataPosition && findDataPosition?.id"
|
|
|
|
|
:settings="findDataPosition?.settings"
|
|
|
|
|
:component="findDataPosition"
|
|
|
|
|
:content="findDataPosition?.content"
|
|
|
|
|
/>
|
|
|
|
|
<div v-else class="text-center">
|
|
|
|
|
<span>Hãy tạo thành phần "Thanh điều hướng ở đầu trang" để hiển thị thành điều hướng tại đây</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
|
|
</style>
|