微信小程序bug1:wepy在onLod周期函数里面赋值了,没有更新到视图上
onLoad(){ try { var res = wx.getSystemInfoSync(); //每一个字母所占的高度 this.apHeight = res.windowHeight / 26; //this.setData({ windowHeight: res.windowHeight }); this.windowHeight = res.windowHeight; console.log(this.windowHeight ); } catch (e) { } }
打印结果
页面展示:
赋值成功了,但是页面没有更新过来
最终代码
其实 this.$apply(),就是这句代码起作用了,。记录一下方便以后查阅
小程序声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

