<button :disabled="flag" :plain="true" hover-class='none' :hair-line='false' size="" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button>
if(!this.flag){
this.flag = true
console.log('e--->',e)
console.log('this.flag--->',this.flag)
if(e.detail.errMsg == 'getPhoneNumber:fail user deny'){
this.showtoast('已拒绝授权')
this.flag = false
return false
}else{
console.log('e',e)
}
}
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
会有这种事?
mounted() { this.flag = false }, methods: { getPhoneNumber(e) { this.flag = true if (e.detail.errMsg === 'getPhoneNumber:ok') { console.log(e.detail.code) // 做你的解析手机号的操作,解析成功后设置this.flag = false wx.showLoading({title: '加载中', mask: true}) wx.request({ url: 'xxx', success: res => { console.log(res) } complete: resp => { wx.hideLoading() this.flag = false } }) } else { this.flag = false } } }