zoukankan      html  css  js  c++  java
  • 如何在vue-cli中引用使用echarts插件

    下载 cnpm install echarts -S

    在mian.js文件中引入

    const ECharts =require('echarts')
    Vue.prototype.$echarts = ECharts;
     
    在chart.vue文件中使用
    <template>
      <div>
          <div ref="chart" style=" 300px; height: 300px"></div>
      </div>
    </template>
    
    <script>
    
    export default {
      mounted() {
        this.drawLine();
      },
      methods: {
        drawLine() {
          let mychart = this.$echarts.init(this.$refs.chart);
          mychart.setOption({
            xAxis: {
              data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
            },
            yAxis: {},
            series: [
              {
                name: "销量",
                type: "bar",
                data: [5, 20, 36, 10, 10, 20],
              },
            ],
          });
        },
      },
    };
    </script>
    
    <style>
    </style>
  • 相关阅读:
    pymysql
    表查询
    元类
    外键约束
    Mysql知识
    C# windows服务的创建与调试
    JQuery随笔
    jQuery插件开发
    http post和put区别
    NPOI
  • 原文地址:https://www.cnblogs.com/shanchui/p/14728028.html
Copyright © 2011-2022 走看看