Echarts WeChat Mini Programs wx:if tags are compatible

I encountered a problem using echarts-for-weixin.

the chart does not load properly when written like this. I don"t know if it"s because I wrote it wrong or because I don"t support it.

<view class="container">
  <view wx:if="">
    <ec-canvas id="mychart-dom-pie" style="width:100%;height:260px;position:absolute;"  canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
  </view>
</view>

and you can write like this:

<view class="container">
<ec-canvas id="mychart-dom-pie" style="width:100%;height:260px;position:absolute;"  canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas>
</view>

this.setData () executes asynchronously, and the function executed by echarts is Synchronize's `< view class= "container" >

.
<view wx:if="{{currentIndex == 2}}">
    <ec-canvas id="mychart-dom-bar" style="position:absolute;" canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>
</view>

< / view > `

`data: {

currentIndex : 2,
ec: {
  onInit: initChart
}    

}, `

the example above, wx:if is able to display charts, has nothing to do with wx:if, the problem is that the this.setData () execution is asynchronous.

Menu