zoukankan      html  css  js  c++  java
  • vue中e-charts的基本使用

    1.安装e-charts项目依赖

    npm install echarts --save

    或者

    npm install echarts -S

    2.引入项目中

    全局引入(main.js)

    import echarts from 'echarts'

    Vue.prototype.$echarts = echarts

    这种方法是直接绑定在vue实例上,所以在项目中任何页面,直接 this.$echarts 即可

    局部引入(需要的页面进行引入)

    import echarts from 'echarts'

    3.初始化echarts

    首先在你需要echarts的页面中得创建一个dom元素

    <div id="myCharts" ref="myCharts"></div>

    其次,在mounted中初始化echarts( 不能写在created中)

    1.const  myCharts = this.$echarts.init(this.$refs.myCharts);
    2.let options = {
    xxx
    }
    3.
    myCharts.setOption(options);
     





  • 相关阅读:
    apio2018题解
    ynoi2018
    hdu2036
    Morley's Theorem
    计算几何
    luogu1355 神秘大三角
    poj2398
    洛谷---小L和小K的NOIP考后放松赛
    LibreOJ β Round #7
    python3
  • 原文地址:https://www.cnblogs.com/xiao-peng-ji/p/11655564.html
Copyright © 2011-2022 走看看