var screenbright=0.5
getScreenBrightness:function(){
wx.getScreenBrightness({
success(res){
console.log("screenbrightness",res)
screenbrightness:res.value
}
})
},
/**setScreenBrightness
* 真机测试不稳定
*/
setScreenBrightness:function(){
var temp=screenbrightness+0.1
screenbrightness=temp
wx.setScreenBrightness({
value: (temp>1?1:temp),
success(res){
console.log("setScreenBrightness",res)
}
})
},
screenbrightness {value: 0.25147944688796997, errMsg: "getScreenBrightness:ok"}
index.js:28 setScreenBrightness {errMsg: "setScreenBrightness:ok"}
index.js:14 screenbrightness {value: 0.6000000238418579, errMsg: "getScreenBrightness:ok"}
index.js:28 setScreenBrightness {errMsg: "setScreenBrightness:ok"}
index.js:14 screenbrightness {value: 0.699999988079071, errMsg: "getScreenBrightness:ok"}
index.js:28 setScreenBrightness {errMsg: "setScreenBrightness:ok"}
index.js:14 screenbrightness {value: 0.800000011920929, errMsg: "getScreenBrightness:ok"}
index.js:28 setScreenBrightness {errMsg: "setScreenBrightness:ok"}
index.js:14 screenbrightness {value: 0.8999999761581421, errMsg: "getScreenBrightness:ok"}
index.js:28 setScreenBrightness {errMsg: "setScreenBrightness:ok"}
index.js:14 screenbrightness {value: 1, errMsg: "getScreenBrightness:ok"}
index.js:28 setScreenBrightness {errMsg: "setScreenBrightness:ok"}
index.js:14 screenbrightness {value: 1, errMsg: "getScreenBrightness:ok"}
index.js:14 screenbrightness {value: 0.2415519505739212, errMsg: "getScreenBrightness:ok"}
index.js:28 setScreenBrightness {errMsg: "setScreenBrightness:ok"}
index.js:14 screenbrightness {value: 0.2415519505739212, errMsg: "getScreenBrightness:ok"}
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)