From fbbf95e2fc452884df96c7f87fe8a79f8e5835d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=98=89=E8=B1=AA?=
<42510293+ziyujiahao@users.noreply.github.com>
Date: Wed, 3 Sep 2025 11:08:38 +0800
Subject: [PATCH] refactor: Optimize the tab component to resize internal
components and follow the tab component to jump proportionally (#106)
---
.../src/views/chat/chat-block/ChartBlock.vue | 4 +-
.../src/views/dashboard/canvas/CanvasCore.vue | 8 ++-
.../dashboard/components/sq-tab/index.vue | 66 +++++++++++--------
3 files changed, 47 insertions(+), 31 deletions(-)
diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue
index a0553e8a..a8d8c502 100644
--- a/frontend/src/views/chat/chat-block/ChartBlock.vue
+++ b/frontend/src/views/chat/chat-block/ChartBlock.vue
@@ -63,6 +63,8 @@ const dataObject = computed<{
const assistantStore = useAssistantStore()
const isCompletePage = computed(() => !assistantStore.getAssistant || assistantStore.getEmbedded)
+const isAssistant = computed(() => assistantStore.getAssistant)
+
const chartId = computed(() => props.message?.record?.id + (props.enlarge ? '-fullscreen' : ''))
const data = computed(() => {
@@ -395,7 +397,7 @@ watch(
-
+
diff --git a/frontend/src/views/dashboard/canvas/CanvasCore.vue b/frontend/src/views/dashboard/canvas/CanvasCore.vue
index d1545078..e574ebb6 100644
--- a/frontend/src/views/dashboard/canvas/CanvasCore.vue
+++ b/frontend/src/views/dashboard/canvas/CanvasCore.vue
@@ -864,7 +864,7 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
html2canvas(clonedSlot).then((canvas) => {
img.src = canvas.toDataURL()
- infoBox.value.cloneItem.appendChild(img)
+ infoBox.value.cloneItem?.appendChild(img)
})
if (containerRef.value) {
@@ -994,6 +994,12 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
if (infoBox.value.resizeItem) {
delete infoBox.value.resizeItem.isPlayer
props.resizeEnd(e, infoBox.value.resizeItem, infoBox.value.resizeItem._dragId)
+
+ if (infoBox.value.resizeItem.component === 'SQTab') {
+ const refTabInstance =
+ currentInstance.refs['shape_component_' + infoBox.value.resizeItem.id][0]
+ refTabInstance.outResizeEnd()
+ }
}
if (infoBox.value.moveItem) {
props.dragEnd(e, infoBox.value.moveItem, infoBox.value.moveItem._dragId)
diff --git a/frontend/src/views/dashboard/components/sq-tab/index.vue b/frontend/src/views/dashboard/components/sq-tab/index.vue
index 2bb1c819..06a44e97 100644
--- a/frontend/src/views/dashboard/components/sq-tab/index.vue
+++ b/frontend/src/views/dashboard/components/sq-tab/index.vue
@@ -119,7 +119,12 @@ const beforeHandleCommand = (item: any, param: any) => {
}
}
const isEditMode = computed(() => props.showPosition === 'canvas')
-
+const outResizeEnd = () => {
+ state.tabShow = false
+ nextTick(() => {
+ state.tabShow = true
+ })
+}
const addTabItem = (item: CanvasItem) => {
// do addTabItem
const index = configItem.value.propValue.findIndex(
@@ -168,6 +173,7 @@ onMounted(() => {
defineExpose({
addTabItem,
+ outResizeEnd,
})
@@ -224,35 +230,37 @@ defineExpose({
-
-
-
emits('parentAddItemBox', item)"
+
+
-
-
+
+ emits('parentAddItemBox', item)"
+ >
+
+
+