20260728225443
This commit is contained in:
1 parent
5ec7aadef9
commit
f6b79ea09a
30 files changed
+1541
-1120
No files matched your search
@@ -13,10 +13,12 @@ import {
|
||||
} from "@lucide/vue";
|
||||
import { theme } from "antdv-next";
|
||||
import { useAppStore } from "@/stores/app";
|
||||
import { usePermissionStore } from "@/stores/permissions";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const appStore = useAppStore();
|
||||
const permissionStore = usePermissionStore();
|
||||
const { token } = theme.useToken();
|
||||
const headerRef = ref(null);
|
||||
const trackRef = ref(null);
|
||||
@@ -34,6 +36,7 @@ watch(
|
||||
appStore.addVisitedTab({
|
||||
key: route.fullPath,
|
||||
label: getTabLabel(),
|
||||
i18nKey: getTabI18nKey(),
|
||||
closable: route.fullPath !== "/dashboard",
|
||||
});
|
||||
}
|
||||
@@ -74,6 +77,18 @@ function getTabLabel() {
|
||||
return route.meta.title;
|
||||
}
|
||||
|
||||
function getTabI18nKey() {
|
||||
if (route.path === "/dashboard") return "common.dashboard";
|
||||
const module = permissionStore.modules.find(
|
||||
(item) => item.b_code === route.meta.moduleId || item.b_route === route.path,
|
||||
);
|
||||
return module?.b_i18n || "";
|
||||
}
|
||||
|
||||
function getDisplayTabLabel(item) {
|
||||
return appStore.t(item.i18nKey, item.label);
|
||||
}
|
||||
|
||||
function closeTab(targetKey) {
|
||||
if (typeof targetKey !== "string" || targetKey === "/dashboard") return;
|
||||
|
||||
@@ -226,7 +241,7 @@ function toggleMaximize() {
|
||||
@click="changeTab(item.key)"
|
||||
@keydown="handleTabKeydown($event, index)"
|
||||
>
|
||||
<span>{{ item.label }}</span>
|
||||
<span>{{ getDisplayTabLabel(item) }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="item.closable"
|
||||
|
||||
Reference in new issue
Block a user