VUE 封装一个echart组件


子组件




父组件

 <linegraph
              :id="'ss'"
              :data="optionPies"
              style="width: 500px; height: 300px"
            >
// 导入 子组件
import linegraph from "./Echart";
// 引用子组件
components: {  linegraph },

// 数据源
      this.optionPies = {
        tooltip: {
          trigger: "item",
          formatter: "{a} 
{b} : {c} ({d}%)", }, legend: { left: "center", bottom: "6", data: ["微信支付笔数", "对公支付笔数"], }, color: ["#2FCBCB", "#34A0FF"], series: [ { name: "支付笔数", type: "pie", radius: ["30%", 95], center: ["50%", "38%"], label: { normal: { show: false, }, }, data: this.wxListtotal, animationEasing: "cubicInOut", animationDuration: 2600, }, ], };
vue