From 4cec162f536af5f109f76354088caff705d6faf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 4 Sep 2026 21:48:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(analytics):=20A1=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E9=A1=B5=E2=80=94=E2=80=94=E5=8D=A1=E7=89=87?= =?UTF-8?q?/=E5=BC=82=E5=B8=B8=E8=AD=A6=E7=A4=BA/=E8=B6=8B=E5=8A=BF?= =?UTF-8?q?=E6=8A=98=E7=BA=BF/=E6=95=B0=E6=8D=AE=E6=88=AA=E8=87=B3?= =?UTF-8?q?=E8=A7=92=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Code --- yunkes/src/composables/useChart.ts | 6 +- yunkes/src/views/analytics/DashboardView.vue | 245 ++++++++++++++++++- 2 files changed, 246 insertions(+), 5 deletions(-) diff --git a/yunkes/src/composables/useChart.ts b/yunkes/src/composables/useChart.ts index 4bf6e7d..46072b5 100644 --- a/yunkes/src/composables/useChart.ts +++ b/yunkes/src/composables/useChart.ts @@ -1,5 +1,6 @@ // ECharts 按需封装(2026-09-04):注册/主题/自适应/销毁一处管——后续所有 // 图表页复用(二批 A2/A4/A5 直接 import 本 composable)。 +// 契约:容器须稳定存在(v-show 可,v-if 卸载重建不支持——chart 只 init 一次)。 import { onBeforeUnmount, type Ref } from 'vue' import * as echarts from 'echarts/core' import { LineChart, BarChart } from 'echarts/charts' @@ -14,7 +15,10 @@ export function useChart(el: Ref) { let ro: ResizeObserver | null = null const render = (option: EChartsCoreOption) => { - if (!el.value) return + if (!el.value) { + console.warn('[useChart] render called before element mounted') + return + } if (!chart) { chart = echarts.init(el.value) ro = new ResizeObserver(() => chart?.resize()) diff --git a/yunkes/src/views/analytics/DashboardView.vue b/yunkes/src/views/analytics/DashboardView.vue index 3aae942..1d50bd8 100644 --- a/yunkes/src/views/analytics/DashboardView.vue +++ b/yunkes/src/views/analytics/DashboardView.vue @@ -1,8 +1,245 @@ - + + +