微信小程序 echarts this.chart.getZr is not a function 解决办法

最近开发微信小程序,使用 echarts 制作图表。

在点击图表内容的时候,会出现  this.chart.getZr is not a function 的错误。

微信小程序 echarts  this.chart.getZr is not a function

到网上查了,没找到答案。

最后一行一行测试。

发现是 async 引起的问题。

所有获取数据的方法,我都是通过异步 new Promise 来返回数据。

只要方法前面加了 async 就不行。

既然用不成 await,就直接地狱回调得了。

微信小程序 echarts  this.chart.getZr is not a function

其实也还好,就调用两次网络请求。

这样就可以在图表上点击了,会出现点击提示。

微信小程序 echarts  this.chart.getZr is not a function

 

微信小程序 echarts  this.chart.getZr is not a function

 

林羽凡待办

评论 (0)

未连接

暂无评论,快来发表第一条评论吧!