項目中用到了一個簡單的折線圖,我打算用echars實現,引入之后項目大小達到了3M多,為了減少項目大小,我打算按需加載折線圖import echarts from "echarts";
let chart = null;
function initChart(canvas, width, height) {
chart = echarts.init(canvas, null, { width: width, height: height
});
canvas.setChart(chart);
var option = {
title: { text: this.title,
textStyle: {
fontSize: "15"
},
subtext: this.subtext
}, //...echars如何在vue中按需加載呢?
1 回答

繁華開滿天機
TA貢獻1816條經驗 獲得超4個贊
// 引入 ECharts 主模塊 var echarts = require('echarts/lib/echarts'); // 引入折線圖 require('echarts/lib/chart/line'); // 引入提示框和標題組件 require('echarts/lib/component/title');
添加回答
舉報
0/150
提交
取消