IOS10.3.3小程序屏幕亮度设置为最高后,会自动变为原来的亮度?
IOS10.3.3小程序屏幕亮度设置为最高后,在当前页面不做任何操作,会自动变为原来的亮度,代码如下
onLoad: function(options) {
var that =this;
wx.getScreenBrightness({
success: function(res){
// 这里是把获取到的手机屏幕亮度,存储到data里面,方便给到页面生命周期隐藏和卸载方法里面用
that.Brightness = res.value;
if(res.value != 1){
console.log(res.value)
uni.setScreenBrightness({
value: 1
});
}
}
})
},
onUnload: function () {
wx.setScreenBrightness({value: this.Brightness })
},
onHide() {
wx.setScreenBrightness({value: this.Brightness })
},