iOS 上模板渲染数据为空(异步setData)
iOS 11 上出现数据渲染不出来的bug,主要表现为:
异步setData 的值在模板上为空(偶尔也正常,但大概率为空);
仅在iOS11 上出现,旧版iOS 和安卓和开发工具上都没出现这个问题;
代码如下,getApp().getAreaNameById 是一个Promise 方法,出来的supplier_address 有值,但模板上为空:
if (supplier_address) { getApp().getAreaNameById({ provinceId: supplier_address.province_code, cityId: supplier_address.city_code, countiesId: supplier_address.county_code }).then(area => { supplier_address.detailAddress = `${area}${supplier_address.detail_address}` that.setData({ supplier_address }) }) } |
下图图一为有问题的截图,图二为安卓:
![](https://image.wxopen.club/content_92fd387e-382d-11ea-960c-001a7dda7111.png)
![](https://image.wxopen.club/content_930b378c-382d-11ea-9b8b-001a7dda7111.png)