From d52df32f8c7542b3f2801972bb210096f181a25f Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Tue, 14 Jun 2022 16:20:40 +0800 Subject: [PATCH] set url --- src/views/dashboard/controls/Tab.vue | 10 +++++++++- .../dashboard/related/topology/components/Graph.vue | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue index 7ae28b8c..2efe3419 100644 --- a/src/views/dashboard/controls/Tab.vue +++ b/src/views/dashboard/controls/Tab.vue @@ -168,6 +168,11 @@ export default defineComponent({ dashboardStore.layout[l].children[activeTabIndex.value].children ); needQuery.value = true; + if (route.params.activeTabIndex) { + let p = location.href.split("/tab/")[0]; + p = p + "/tab/" + activeTabIndex.value; + history.replaceState({}, "", p); + } } function removeTab(e: Event) { e.stopPropagation(); @@ -217,9 +222,12 @@ export default defineComponent({ ); } function copyLink() { - let path = location.href; + let path = ""; if (route.params.activeTabIndex === undefined) { path = location.href + "/tab/" + activeTabIndex.value; + } else { + const p = location.href.split("/tab/")[0]; + path = p + "/tab/" + activeTabIndex.value; } copy(path); } diff --git a/src/views/dashboard/related/topology/components/Graph.vue b/src/views/dashboard/related/topology/components/Graph.vue index c075a5d0..4ebdbf1b 100644 --- a/src/views/dashboard/related/topology/components/Graph.vue +++ b/src/views/dashboard/related/topology/components/Graph.vue @@ -538,6 +538,9 @@ function setNodeTools(nodeDashboard: any) { } } async function freshNodes() { + if (!svg.value) { + return; + } svg.value.selectAll(".topo-svg-graph").remove(); await init(); update();