vue中引入echarts并实现echarts自适应
在许多项目中需要使用到柱状图、饼状图等,在本篇博客中介绍echarts的自适应。
实现echarts的自适应可以使用window.onresize(),具体操作如下:
npm安装echats:
npm install echarts --save
在使用echarts的页面引入echarts
let echarts = require('echarts/lib/echarts')
//根据需要引入相应图的组件
require('echarts/lib/chart/bar')//柱状图
require("echarts/lib/chart/lines")//折线图
require('echarts/lib/chart/pie')/