fix: 修复图表组件运行时错误
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 16s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

- 将 getChartOptionsByType 替换为 getChartOptions
- 修复 MonthlyExpenseCard.vue 中的图表配置
- 修复 ExpenseCategoryCard.vue 中的图表配置
- 修复 BudgetChartAnalysis.vue 中的图表配置
- 统计页面、日历页面、预算页面运行正常,无控制台错误
This commit is contained in:
SunCheng
2026-02-18 22:19:25 +08:00
parent 5e38a52e5b
commit 0101c3e366
3 changed files with 8 additions and 8 deletions

View File

@@ -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,

View File

@@ -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: {

View File

@@ -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 }