fix: activate the correct tab index after renaming a Tabs name (#103)

This commit is contained in:
Fine0830 2022-06-06 16:36:04 +08:00 committed by GitHub
parent 30069ce825
commit c875c95c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -1,4 +1,3 @@
import { ElMessage } from "element-plus";
/** /**
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View File

@ -29,7 +29,7 @@ limitations under the License. -->
:h="item.h" :h="item.h"
:i="item.i" :i="item.i"
:key="item.i" :key="item.i"
@click="clickGrid(item)" @click="clickGrid(item, $event)"
:class="{ active: dashboardStore.activedGridItem === item.i }" :class="{ active: dashboardStore.activedGridItem === item.i }"
:drag-ignore-from="dragIgnoreFrom" :drag-ignore-from="dragIgnoreFrom"
> >
@ -55,10 +55,13 @@ export default defineComponent({
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
function clickGrid(item: LayoutConfig) { function clickGrid(item: LayoutConfig, event: Event) {
dashboardStore.activeGridItem(item.i); dashboardStore.activeGridItem(item.i);
dashboardStore.selectWidget(item); dashboardStore.selectWidget(item);
if (item.type === "Tab") { if (
item.type === "Tab" &&
(event.target as HTMLDivElement)?.className !== "tab-layout"
) {
dashboardStore.setActiveTabIndex(0); dashboardStore.setActiveTabIndex(0);
} }
} }

View File

@ -80,7 +80,7 @@ limitations under the License. -->
</div> </div>
<div class="flex-h tools" v-loading="loading" v-if="!appStore.isMobile"> <div class="flex-h tools" v-loading="loading" v-if="!appStore.isMobile">
<div class="tool-icons flex-h" v-if="dashboardStore.editMode"> <div class="tool-icons flex-h" v-if="dashboardStore.editMode">
<el-dropdown content="Controls" placement="bottom"> <el-dropdown content="Controls" placement="bottom" :persistent="false">
<i> <i>
<Icon class="icon-btn" size="sm" iconName="control" /> <Icon class="icon-btn" size="sm" iconName="control" />
</i> </i>

View File

@ -40,7 +40,12 @@ limitations under the License. -->
@change="changeAggregateType" @change="changeAggregateType"
class="selector mr-10" class="selector mr-10"
/> />
<el-popover placement="bottom" :width="680" trigger="click"> <el-popover
placement="bottom"
:width="680"
trigger="click"
:persistent="false"
>
<template #reference> <template #reference>
<el-button type="primary" size="small"> <el-button type="primary" size="small">
{{ t("processSelect") }} {{ t("processSelect") }}