From ca89301bf689244eda6ac1ac733aa66d28b6c366 Mon Sep 17 00:00:00 2001 From: ulleo Date: Tue, 5 Aug 2025 15:07:54 +0800 Subject: [PATCH] fix: default chart type in chat --- .../src/views/chat/chat-block/ChartBlock.vue | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue index 86ab2b36..d1cc908e 100644 --- a/frontend/src/views/chat/chat-block/ChartBlock.vue +++ b/frontend/src/views/chat/chat-block/ChartBlock.vue @@ -2,7 +2,7 @@ import type { ChatMessage } from '@/api/chat.ts' import DisplayChartBlock from '@/views/chat/component/DisplayChartBlock.vue' import ChartPopover from '@/views/chat/chat-block/ChartPopover.vue' -import { computed, ref } from 'vue' +import { computed, ref, watch } from 'vue' import { concat } from 'lodash-es' import type { ChartTypes } from '@/views/chat/component/BaseChart.ts' import ICON_BAR from '@/assets/svg/chart/icon_bar_outlined.svg' @@ -246,6 +246,7 @@ function exportToExcel() { }) exportRef.value?.hide() } + function exportToImage() { const obj = document.getElementById('chart-component-' + chartId.value) if (obj) { @@ -265,6 +266,15 @@ function exportToImage() { } exportRef.value?.hide() } + +watch( + () => chartObject.value.type, + (val) => { + if (val) { + currentChartType.value = val + } + } +)