This commit is contained in:
Qiuxia Fan 2022-03-25 15:08:35 +08:00
parent e19e03d413
commit 5593416257
4 changed files with 7 additions and 2 deletions

View File

@ -22,7 +22,7 @@ export const NewControl = {
i: "0", i: "0",
type: "Widget", type: "Widget",
widget: { widget: {
title: "Title", title: "",
}, },
graph: {}, graph: {},
standard: {}, standard: {},

View File

@ -164,6 +164,7 @@ export const dashboardStore = defineStore({
} }
if (type === "Text") { if (type === "Text") {
newItem.h = 6; newItem.h = 6;
newItem.graph = TextConfig;
} }
if (this.layout[idx].children) { if (this.layout[idx].children) {
const items = children.map((d: LayoutConfig) => { const items = children.map((d: LayoutConfig) => {

View File

@ -121,6 +121,7 @@ import Widget from "./Widget.vue";
import Trace from "./Trace.vue"; import Trace from "./Trace.vue";
import Profile from "./Profile.vue"; import Profile from "./Profile.vue";
import Log from "./Log.vue"; import Log from "./Log.vue";
import Text from "./Text.vue";
const props = { const props = {
data: { data: {
@ -131,7 +132,7 @@ const props = {
}; };
export default defineComponent({ export default defineComponent({
name: "Tab", name: "Tab",
components: { Topology, Widget, Trace, Profile, Log }, components: { Topology, Widget, Trace, Profile, Log, Text },
props, props,
setup(props) { setup(props) {
const { t } = useI18n(); const { t } = useI18n();

View File

@ -59,6 +59,9 @@ export default defineComponent({
function clickGrid(item: LayoutConfig) { function clickGrid(item: LayoutConfig) {
dashboardStore.activeGridItem(item.i); dashboardStore.activeGridItem(item.i);
dashboardStore.selectWidget(item); dashboardStore.selectWidget(item);
if (item.type === "Tab") {
dashboardStore.setActiveTabIndex(0);
}
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {
dashboardStore.setLayout([]); dashboardStore.setLayout([]);