From c2f7c6af47e9a14c8bf0c4c500539243cffc3728 Mon Sep 17 00:00:00 2001 From: unitwk Date: Sun, 3 Sep 2023 12:22:04 +0800 Subject: [PATCH] Fix: echarts import --- frontend/src/hooks/useOverviewChart.ts | 14 +++++++------- frontend/src/widgets/UserList.vue | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/hooks/useOverviewChart.ts b/frontend/src/hooks/useOverviewChart.ts index bc8266c5..96ea86a2 100644 --- a/frontend/src/hooks/useOverviewChart.ts +++ b/frontend/src/hooks/useOverviewChart.ts @@ -1,11 +1,11 @@ -import * as echarts from "echarts"; +import { init, graphic, type ECharts } from "echarts"; import { onMounted, onUnmounted, ref } from "vue"; export function useSimpleChart(dom: string, initData: number[] = []) { - let chart = ref(); + let chart = ref(); onMounted(() => { - chart.value = echarts.init(document.getElementById(dom)); + chart.value = init(document.getElementById(dom)); chart.value.setOption(getSimpleChartDefaultOption(initData)); }); @@ -21,10 +21,10 @@ export function useSimpleChart(dom: string, initData: number[] = []) { } export function useOverviewChart(dom: string) { - let chart = ref(); + let chart = ref(); onMounted(() => { - chart.value = echarts.init(document.getElementById(dom)); + chart.value = init(document.getElementById(dom)); chart.value.setOption(getChartDefaultOption()); }); @@ -40,7 +40,7 @@ export function useOverviewChart(dom: string) { } function getChartDefaultOption() { - const color: any = new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + const color: any = new graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "rgb(67, 145, 250,0.8)" @@ -101,7 +101,7 @@ function getSimpleChartDefaultOption(data: number[] = []) { width: 1 }, areaStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + color: new graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "rgb(67, 145, 250,0.8)" diff --git a/frontend/src/widgets/UserList.vue b/frontend/src/widgets/UserList.vue index 56ceb2c8..bc1a8d05 100644 --- a/frontend/src/widgets/UserList.vue +++ b/frontend/src/widgets/UserList.vue @@ -258,7 +258,9 @@ onMounted(async () => { ) }}
- 具体信息参考 + + {{ t("了解更多") }} +