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) {            }    }

打印结果
小程序
页面展示:
小程序
赋值成功了,但是页面没有更新过来
最终代码

onLoad(){        try {            var res = wx.getSystemInfoSync();            //每一个字母所占的高度            this.apHeight = res.windowHeight / 26;            //this.setData({ windowHeight: res.windowHeight });            this.windowHeight = res.windowHeight;            console.log(this.windowHeight);            this.$apply();            } catch (e) {            }    }

其实 this.$apply(),就是这句代码起作用了,。记录一下方便以后查阅

小程序

TAG标签: 微信小程序微信bug

http://www.xiaochengxub.com/read-106471.html