From 9748971aa14d48401cb361db9eeebadecda00059 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 25 Jun 2025 15:19:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtab=E4=B8=AD=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=8F=90=E7=A4=BA=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-component/de-tabs/Component.vue | 39 +++++++++---------- core/core-frontend/src/utils/canvasUtils.ts | 1 + 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/core/core-frontend/src/custom-component/de-tabs/Component.vue b/core/core-frontend/src/custom-component/de-tabs/Component.vue index f1aa098a4b..92e0d08ae3 100644 --- a/core/core-frontend/src/custom-component/de-tabs/Component.vue +++ b/core/core-frontend/src/custom-component/de-tabs/Component.vue @@ -12,7 +12,7 @@ ref="tabComponentRef" > { const { backgroundImageEnable, backgroundType, innerImage } = element.value.titleBackground.inActive return ( - editableTabsValue.value !== itemName && + element.value.editableTabsValue !== itemName && !element.value.titleBackground.multiply && element.value.titleBackground?.enable && backgroundImageEnable && @@ -262,7 +263,7 @@ const svgInnerInActiveEnable = itemName => { const svgInnerActiveEnable = itemName => { const { backgroundImageEnable, backgroundType, innerImage } = element.value.titleBackground.active return ( - (editableTabsValue.value === itemName || element.value.titleBackground.multiply) && + (element.value.editableTabsValue === itemName || element.value.titleBackground.multiply) && element.value.titleBackground?.enable && backgroundImageEnable && backgroundType === 'innerImage' && @@ -274,7 +275,7 @@ const svgInnerActiveEnable = itemName => { const viewToolTipsChange = () => { element.value.propValue?.forEach(tabItem => { const tMethod = - editableTabsValue.value === tabItem.name + element.value.editableTabsValue === tabItem.name ? ChartCarouselTooltip.resume : ChartCarouselTooltip.paused tabItem.componentData?.forEach(componentItem => { @@ -303,7 +304,6 @@ const state = reactive({ hoverFlag: false }) const tabsAreaScroll = ref(false) -const editableTabsValue = ref(null) // 无边框 const noBorderColor = ref('none') @@ -360,7 +360,7 @@ function addTab() { closable: true } element.value.propValue.push(newTab) - editableTabsValue.value = newTab.name + element.value.editableTabsValue = newTab.name snapshotStore.recordSnapshotCache('addTab') } @@ -372,7 +372,7 @@ function deleteCur(param) { element.value.propValue.splice(len, 1) const activeIndex = (len - 1 + element.value.propValue.length) % element.value.propValue.length - editableTabsValue.value = element.value.propValue[activeIndex].name + element.value.editableTabsValue = element.value.propValue[activeIndex].name state.tabShow = false nextTick(() => { state.tabShow = true @@ -426,7 +426,7 @@ const reloadLinkage = () => { const componentMoveIn = component => { element.value.propValue.forEach((tabItem, index) => { - if (editableTabsValue.value === tabItem.name) { + if (element.value.editableTabsValue === tabItem.name) { //获取主画布当前组件的index if (isDashboard()) { eventBus.emit('removeMatrixItemById-canvas-main', component.id) @@ -541,7 +541,7 @@ const backgroundStyle = backgroundParams => { const titleStyle = itemName => { let style = {} - if (editableTabsValue.value === itemName) { + if (element.value.editableTabsValue === itemName) { style = { textDecoration: element.value.style.textDecoration, fontStyle: element.value.style.fontStyle, @@ -620,10 +620,15 @@ const titleValid = computed(() => { return !!state.textarea && !!state.textarea.trim() }) +const viewToolTipsChangeDebounce = debounce(() => { + viewToolTipsChange() +}, 500) + watch( () => element.value, () => { calcTabLength() + viewToolTipsChangeDebounce() }, { deep: true } ) @@ -642,12 +647,6 @@ watch( } ) -watch( - () => editableTabsValue.value, - () => { - viewToolTipsChange() - } -) const initCarousel = () => { carouselTimer && clearInterval(carouselTimer) carouselTimer = null @@ -662,7 +661,7 @@ const initCarousel = () => { const nowIndex = switchCount % element.value.propValue.length switchCount++ nextTick(() => { - editableTabsValue.value = element.value.propValue[nowIndex].name + element.value.editableTabsValue = element.value.propValue[nowIndex].name }) } }, switchTime) @@ -672,7 +671,7 @@ const initCarousel = () => { onMounted(() => { if (element.value.propValue.length > 0) { - editableTabsValue.value = element.value.propValue[0].name + element.value.editableTabsValue = element.value.propValue[0].name } calcTabLength() if (['canvas', 'canvasDataV', 'edit'].includes(showPosition.value) && !mobileInPc.value) { diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index 50f3685fa9..a0bb381872 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -165,6 +165,7 @@ export function historyItemAdaptor( } if (componentItem.component === 'DeTabs') { + componentItem['editableTabsValue'] = componentItem['editableTabsValue'] || '' componentItem.style['showTabTitle'] = componentItem.style['showTabTitle'] === undefined ? true : componentItem.style['showTabTitle'] }