Commit 2190a231 by User

标签页关闭、显示异常问题解决

parent 2deba187
<!doctype html>
<html lang="zh-cmn-Hans">
<head>
<meta name="buildTime" content="2025-04-25 14:26:56">
<meta name="buildTime" content="2025-04-25 15:49:09">
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" />
<title>VueDashboard</title>
<script type="module" crossorigin src="/Content/VueDashboardUi/VueDashboard1/assets/index-BNcrQaoq.js"></script>
<script type="module" crossorigin src="/Content/VueDashboardUi/VueDashboard1/assets/index-CrvCiZyA.js"></script>
<link rel="stylesheet" crossorigin href="/Content/VueDashboardUi/VueDashboard1/assets/index-DhhgO4aJ.css">
</head>
<body>
......
......@@ -6,6 +6,7 @@ import { useEventBus } from '@vueuse/core'; // 添加事件总线
import { loadModule } from 'vue3-sfc-loader';
import { getSelectMenu } from '@/service/api';
import NotFound from '@/views/_builtin/404/index.vue'; // 引入 404 组件
import { useTabStore } from '@/store/modules/tab';
import ExtJsComponent from './extJs.vue';
import WebviewComponent from './webview.vue';
import VueComponent from './vueComponent.vue'; // 添加新组件导入
......@@ -31,7 +32,9 @@ const extJsRef = ref<any>(null);
const vueComponentRef = ref<any>(null);
// 监听标签关闭事件
const tabCloseEventBus = useEventBus('tab-close');
const tabCloseEventBus = useEventBus<string>('tab-close');
const tabStore = useTabStore();
// 清理所有资源的函数
const cleanupResources = () => {
......@@ -60,8 +63,11 @@ const cleanupResources = () => {
};
// 监听标签关闭事件
tabCloseEventBus.on(() => {
cleanupResources();
tabCloseEventBus.on(closedTabId => {
// 只有当关闭的是当前标签时才清理资源
if (closedTabId === tabStore.activeTabId) {
cleanupResources();
}
});
// 组件卸载前清理
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment