Zhuyi731/echarts-for-wx-uniapp

vue3中使用的问题

Opened this issue · 0 comments

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)