Zhuyi731 / echarts-for-wx-uniapp

uni-app echarts vue2小程序专用
331 stars 37 forks source link

vue3中使用的问题 #39

Open louyuoops opened 2 years ago

louyuoops commented 2 years ago

vue3中需要修改一下uni-ec-canvas.vue中的initChart方法

initChart(canvas, width, height, canvasDpr) {
          console.log("probe6:", canvas, width, height, canvasDpr)
        const chart = echarts.init(canvas, null, {
          width: width,
          height: height,
          devicePixelRatio: canvasDpr
        });
        canvas.setChart(chart);
        console.log("probe3:", chart)
        if (!chart) {
            // this.initChart(canvas, width, height, canvasDpr)
            return
        }
        chart.setOption(this.ec.option);
        console.log("probe4")
        this.$emit('inited', chart)
        return chart
      }

把this.$curChart更换为局部变量(我也不太明白为啥,没有仔细学过js和vue)