From 55934162575eb2e6a0c75e845ef5c0d2c5743616 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Fri, 25 Mar 2022 15:08:35 +0800 Subject: [PATCH] fix tab --- src/store/data.ts | 2 +- src/store/modules/dashboard.ts | 1 + src/views/dashboard/controls/Tab.vue | 3 ++- src/views/dashboard/panel/Layout.vue | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/store/data.ts b/src/store/data.ts index a5304e23..6fdfdd9b 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -22,7 +22,7 @@ export const NewControl = { i: "0", type: "Widget", widget: { - title: "Title", + title: "", }, graph: {}, standard: {}, diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index b92b36bf..7fa931f6 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -164,6 +164,7 @@ export const dashboardStore = defineStore({ } if (type === "Text") { newItem.h = 6; + newItem.graph = TextConfig; } if (this.layout[idx].children) { const items = children.map((d: LayoutConfig) => { diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue index 2582f3ba..389032ea 100644 --- a/src/views/dashboard/controls/Tab.vue +++ b/src/views/dashboard/controls/Tab.vue @@ -121,6 +121,7 @@ import Widget from "./Widget.vue"; import Trace from "./Trace.vue"; import Profile from "./Profile.vue"; import Log from "./Log.vue"; +import Text from "./Text.vue"; const props = { data: { @@ -131,7 +132,7 @@ const props = { }; export default defineComponent({ name: "Tab", - components: { Topology, Widget, Trace, Profile, Log }, + components: { Topology, Widget, Trace, Profile, Log, Text }, props, setup(props) { const { t } = useI18n(); diff --git a/src/views/dashboard/panel/Layout.vue b/src/views/dashboard/panel/Layout.vue index 93d8ad11..cec440ac 100644 --- a/src/views/dashboard/panel/Layout.vue +++ b/src/views/dashboard/panel/Layout.vue @@ -59,6 +59,9 @@ export default defineComponent({ function clickGrid(item: LayoutConfig) { dashboardStore.activeGridItem(item.i); dashboardStore.selectWidget(item); + if (item.type === "Tab") { + dashboardStore.setActiveTabIndex(0); + } } onBeforeUnmount(() => { dashboardStore.setLayout([]);