Echarts

208 阅读1分钟
  1. 安装echarts依赖
    cnpm i echarts --save (-S)
  2. echarts在项目中的使用
    全局使用 main.js中 如果使用图形列表少的话 不用这种方式 webpack打包会把整个echarts打包进去 打包项目文件会比较大些

    import echarts from 'echarts'
    Vue.prototype.echarts = echarts

    在使用组件位置

    this.echarts

  3. 按需引入:

    引入基本模板

    import echarts from 'echarts/lib/echarts';

    引入需要的图形表格
    import 'echarts/lib/chart/bar';
    import 'echarts/lib/chart/line';


    引入提示库和title组件等
    import 'echarts/lib/component/title';
    import 'echarts/lib/component/legend';
    import 'echarts/lib/component/toolbox';
    import 'echarts/lib/component/markPoint';
    import 'echarts/lib/component/tooltip';