From 0101c3e36631f38edcbc1e39444497523d87b398 Mon Sep 17 00:00:00 2001 From: SunCheng Date: Wed, 18 Feb 2026 22:19:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=BF=90=E8=A1=8C=E6=97=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 getChartOptionsByType 替换为 getChartOptions - 修复 MonthlyExpenseCard.vue 中的图表配置 - 修复 ExpenseCategoryCard.vue 中的图表配置 - 修复 BudgetChartAnalysis.vue 中的图表配置 - 统计页面、日历页面、预算页面运行正常,无控制台错误 --- Web/src/components/Budget/BudgetChartAnalysis.vue | 8 ++++---- .../views/statisticsV2/modules/ExpenseCategoryCard.vue | 4 ++-- Web/src/views/statisticsV2/modules/MonthlyExpenseCard.vue | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Web/src/components/Budget/BudgetChartAnalysis.vue b/Web/src/components/Budget/BudgetChartAnalysis.vue index af4a194..b2c1e35 100644 --- a/Web/src/components/Budget/BudgetChartAnalysis.vue +++ b/Web/src/components/Budget/BudgetChartAnalysis.vue @@ -239,7 +239,7 @@ const showDescriptionPopup = ref(false) const activeDescTab = ref('month') // Chart.js 相关 -const { getChartOptions, getChartOptionsByType } = useChartTheme() +const { getChartOptions } = useChartTheme() const formatMoney = (val) => { if (Math.abs(val) >= 10000) { @@ -500,7 +500,7 @@ const varianceChartData = computed(() => { }) const varianceChartOptions = computed(() => { - return getChartOptionsByType('bar', { + return getChartOptions({ indexAxis: 'y', plugins: { legend: { @@ -655,7 +655,7 @@ const burndownChartData = computed(() => { }) const burndownChartOptions = computed(() => { - return getChartOptionsByType('line', { + return getChartOptions({ plugins: { legend: { display: true, @@ -816,7 +816,7 @@ const yearBurndownChartData = computed(() => { }) const yearBurndownChartOptions = computed(() => { - return getChartOptionsByType('line', { + return getChartOptions({ plugins: { legend: { display: true, diff --git a/Web/src/views/statisticsV2/modules/ExpenseCategoryCard.vue b/Web/src/views/statisticsV2/modules/ExpenseCategoryCard.vue index 549558f..065b2f2 100644 --- a/Web/src/views/statisticsV2/modules/ExpenseCategoryCard.vue +++ b/Web/src/views/statisticsV2/modules/ExpenseCategoryCard.vue @@ -110,7 +110,7 @@ defineEmits(['category-click']) const showAllExpense = ref(false) // Chart.js 相关 -const { getChartOptionsByType } = useChartTheme() +const { getChartOptions } = useChartTheme() let _chartJSInstance = null // 饼图标签引导线 @@ -307,7 +307,7 @@ const totalAmount = computed(() => { const chartOptions = computed(() => { const isDarkMode = document.documentElement.getAttribute('data-theme') === 'dark' - return getChartOptionsByType('doughnut', { + return getChartOptions({ cutout: '65%', layout: { padding: { diff --git a/Web/src/views/statisticsV2/modules/MonthlyExpenseCard.vue b/Web/src/views/statisticsV2/modules/MonthlyExpenseCard.vue index 184cf63..176df26 100644 --- a/Web/src/views/statisticsV2/modules/MonthlyExpenseCard.vue +++ b/Web/src/views/statisticsV2/modules/MonthlyExpenseCard.vue @@ -80,7 +80,7 @@ const props = defineProps({ }) // Chart.js 相关 -const { getChartOptionsByType, colors } = useChartTheme() +const { getChartOptions, colors } = useChartTheme() // 计算结余样式类 const balanceClass = computed(() => ({ @@ -281,7 +281,7 @@ const chartData = computed(() => { const chartOptions = computed(() => { const { chartData: rawData } = prepareChartData() - return getChartOptionsByType('line', { + return getChartOptions({ scales: { x: { display: false }, y: { display: false }