Fix: echarts import

This commit is contained in:
unitwk 2023-09-03 12:22:04 +08:00
parent eb09b65ee6
commit c2f7c6af47
2 changed files with 10 additions and 8 deletions

View File

@ -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<echarts.ECharts>();
let chart = ref<ECharts>();
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<echarts.ECharts>();
let chart = ref<ECharts>();
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)"

View File

@ -258,7 +258,9 @@ onMounted(async () => {
)
}}
<br />
<a href="https://docs.mcsmanager.com/" target="_blank">具体信息参考</a>
<a href="https://docs.mcsmanager.com/" target="_blank">
{{ t("了解更多") }}
</a>
</a-typography-text>
</a-typography-paragraph>
</div>