conflict-nuxt-4/app/pages/index.vue
2026-02-12 11:24:27 +03:30

86 lines
2.4 KiB
Vue
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<Header
:tabs="headerTabs"
v-model:active-tab="activeTabKey"
:is-sidebar-collapsed="isSidebarCollapsed"
:unread-notifications="unreadNotifications"
@tab-change="handleTabChange"
:headerSchema="headerSchema"
/>
<component
:is="currentComponent"
v-if="currentComponent"
:activeTabKey="activeTabKey"
/>
</div>
</template>
<script setup>
definePageMeta({
name: "DashboardBasePage",
layout: "dashboard-layout",
});
import { ref, onMounted } from "vue";
import tabBarData from "@/json/tab-bar/data-entry/dataEntry.json";
import { defineAsyncComponent } from "vue";
const route = useRoute();
// Stateهای Header
const isSidebarCollapsed = ref(false);
const unreadNotifications = ref(5);
const headerTabs = ref([]);
headerTabs.value = tabBarData.tabs;
const activeTabKey = ref(tabBarData.tabs[0]?.key || "");
// const contentSchema = computed(() => ({
// items: items.value,
// }));
const tabComponents = {
MainList: defineAsyncComponent(
() => import("~/components/lazy-load/data-entry/MainList.vue"),
),
RelationEdit: defineAsyncComponent(
() => import("~/components/lazy-load/data-entry/RelationEdit.vue"),
),
RuleEdit: defineAsyncComponent(
() => import("~/components/lazy-load/data-entry/RuleEdit.vue"),
),
// "DataEntryFarhangestan": defineAsyncComponent(() => import("~/components/lazy-load/data-entry/DataEntryFarhangestan.vue")),
// "DataEntryMirbagheri": defineAsyncComponent(() => import("~/components/lazy-load/data-entry/DataEntryMirbagheri.vue")),
// ...
};
const currentComponent = computed(() => {
if (activeTabKey.value == "MainList") {
return tabComponents.MainList;
} else if (activeTabKey.value === "RelationEdit") {
return tabComponents.RelationEdit;
} else if (activeTabKey.value === "RuleEdit") {
return tabComponents.RuleEdit;
}
});
// تابع مدیریت تغییر تب
const handleTabChange = (tab) => {
// منطق تغییر مسیر یا لود داده
switch (tab.id) {
case "dashboard":
break;
case "analytics":
break;
case "users":
break;
case "settings":
break;
default:
}
};
const headerSchema = ref({});
headerSchema.value = {
breadcrumb: true,
logo: false,
};
onMounted(() => {
activeTabKey.value = headerTabs.value[0]?.id || "";
});
</script>