Try fix echart build error

This commit is contained in:
unitwk 2023-09-03 16:46:51 +08:00
parent c2f7c6af47
commit d83183f0ae
3 changed files with 8 additions and 8 deletions

View File

@ -1,12 +1,12 @@
import { init, graphic, type ECharts } from "echarts";
import { onMounted, onUnmounted, ref } from "vue";
export function useSimpleChart(dom: string, initData: number[] = []) {
export function useSimpleChart(dom: string) {
let chart = ref<ECharts>();
onMounted(() => {
chart.value = init(document.getElementById(dom));
chart.value.setOption(getSimpleChartDefaultOption(initData));
chart.value.setOption(getSimpleChartDefaultOption());
});
onUnmounted(() => {
@ -40,7 +40,7 @@ export function useOverviewChart(dom: string) {
}
function getChartDefaultOption() {
const color: any = new graphic.LinearGradient(0, 0, 0, 1, [
const color = new graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgb(67, 145, 250,0.8)"
@ -77,8 +77,7 @@ function getChartDefaultOption() {
};
}
function getSimpleChartDefaultOption(data: number[] = []) {
// const randomNumbers = Array.from({ length: 60 }, () => 0);
function getSimpleChartDefaultOption() {
return {
grid: {
show: false,
@ -92,7 +91,6 @@ function getSimpleChartDefaultOption(data: number[] = []) {
yAxis: { type: "value", min: 0, max: 100, show: false, minInterval: 1 },
series: [
{
// data: data || randomNumbers,
type: "line",
smooth: true,
showSymbol: false,

3
package-lock.json generated
View File

@ -5,7 +5,8 @@
"packages": {
"": {
"dependencies": {
"echarts": "^5.4.3"
"echarts": "^5.4.3",
"zrender": "^5.4.4"
}
},
"node_modules/echarts": {

View File

@ -1,5 +1,6 @@
{
"dependencies": {
"echarts": "^5.4.3"
"echarts": "^5.4.3",
"zrender": "^5.4.4"
}
}