- 当前 Bug 的表现(可附上截图)
connectRtwap: function(){
var that = this
wx.connectWifi({
SSID: “TVConfigure”,
password: “87654321”,
success: function (res) {
console.log(res)
that.connectRtwapCount = 0
var timeTag = setTimeout(function () {
clearTimeout(timeTag)
that.sendToMDNS()
}, 16000)
},
fail: function (res) {
console.log(res)
if (that.connectRtwapCount < 1){
that.connectRtwapCount += 1
var timeTag = setTimeout(function(){
clearTimeout(timeTag)
that.connectRtwap()
}, 13000)
}else{
that.setCommitButtonDisable(false)
wx.hideLoading()
that.connectRtwapCount = 0
that.tagComplete = 2
}
}
})
}
执行此方法时,为什么手机还没连上"TVConfigure"wifi,就执行了onSuccess回调提示connectWifi:Ok?,而且更要命的是:哪怕明明没有连上TVConfigure,也会执行onSuccess回调,不会执行onFail回调
- 预期表现1、应该等wifi确实连接上了或链接失败了才执行onSuccess或onFail回调,不要提前执行这些回调方法2、当连接成功后应该回调onSuccess方法,当连接失败后应该回调onFail方法,不要失败了也回调onSuccess方法
- 复现路径直接执行上述代码,将代码中账号密码换成一个你们测试的wifi的账号密码,就可以复现
- 提供一个最简复现 DemoDemo见上述代码