From 7562f6aa09232acf99ee480f49394f2fa8d9b530 Mon Sep 17 00:00:00 2001 From: canwdev Date: Wed, 11 Dec 2024 18:25:10 +0800 Subject: [PATCH] update: ui --- .../Graphs/{EchartsKLine.vue => EchartsCandlestick.vue} | 9 +++++++-- src/components/AppUtils/StockTracker/StockPrices.vue | 5 +++-- src/components/QuickLaunch/use-common-tools.ts | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) rename src/components/AppUtils/StockTracker/Graphs/{EchartsKLine.vue => EchartsCandlestick.vue} (97%) diff --git a/src/components/AppUtils/StockTracker/Graphs/EchartsKLine.vue b/src/components/AppUtils/StockTracker/Graphs/EchartsCandlestick.vue similarity index 97% rename from src/components/AppUtils/StockTracker/Graphs/EchartsKLine.vue rename to src/components/AppUtils/StockTracker/Graphs/EchartsCandlestick.vue index 174bf99..e6dfe16 100644 --- a/src/components/AppUtils/StockTracker/Graphs/EchartsKLine.vue +++ b/src/components/AppUtils/StockTracker/Graphs/EchartsCandlestick.vue @@ -7,8 +7,9 @@ import {IPriceByDay} from '@/components/AppUtils/StockTracker/types' // 定义 props const props = defineProps<{ byDay: IPriceByDay + title: string }>() - +const {title} = toRefs(props) // 创建 ref const chartRef = ref(null) let chartInstance: echarts.ECharts | null = null @@ -59,7 +60,7 @@ const initChart = () => { const option = { title: [ { - text: 'K Line', + text: props.title, left: 'center', top: 10, }, @@ -157,6 +158,10 @@ onMounted(() => { initChart() }) +watch(title, () => { + initChart() +}) + // 组件卸载时销毁 onUnmounted(() => { if (chartInstance) { diff --git a/src/components/AppUtils/StockTracker/StockPrices.vue b/src/components/AppUtils/StockTracker/StockPrices.vue index f51f575..fc6ceea 100644 --- a/src/components/AppUtils/StockTracker/StockPrices.vue +++ b/src/components/AppUtils/StockTracker/StockPrices.vue @@ -1,7 +1,7 @@