华为 p30 pro <button>组件点击事件不生效
发布于 5 年前 作者 fanggao 4255 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

线上环境   华为 P30 pro 点击wxml 中的<botton>组件 无法调用绑定的方法,在其他设备(开发工具、 华为荣耀,苹果 等机型上都可以)

  • 预期表现
  • 复现路径
  • 提供一个最简复现 Demo

wxml:

<button  bindtap=‘vericode’disabled=’{{disabled}}’ >{{text}}</button>

js:

vericode: function() {

var self = this;

var mobile = this.data.mobile;

var phonetel = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;

if (mobile == ‘’) {

wx.showToast({

title: ‘手机号不能为空’,

icon: ‘none’,

duration: 1500

})

return false

} else if (mobile.length != 11) {

wx.showToast({

title: ‘手机号长度有误!’,

icon: ‘none’,

duration: 1500

})

return false;

} else if (!phonetel.test(mobile)) {

wx.showToast({

title: ‘手机号有误!’,

icon: ‘none’,

duration: 1500

})

return false;

} else {

wx.showToast({

title: ‘短信验证码已发送’,

icon: ‘none’,

duration: 2000

});

var currentTime = self.data.currentTime;

self.setData({

disabled: true,

})

var interval = setInterval(function() {

currentTime–; //每执行一次让倒计时秒数减一

self.setData({

text: currentTime + ‘s’, //按钮文字变成倒计时对应秒数

})

//如果当秒数小于等于0时 停止计时器 且按钮文字变成重新发送 且按钮变成可用状态 倒计时的秒数也要恢复成默认秒数 即让获取验证码的按钮恢复到初始化状态只改变按钮文字

if (currentTime <= 0) {

clearInterval(interval)

self.setData({

text: ‘重新发送’,

currentTime: 61,

disabled: false,

// color: ‘#929fff’

})

}

}, 1000);

wx.request({

url: app.globalData.url + ‘/wxapp/vericode’,

data: {

phone: mobile,

type: 0

},

success: function(res) {

console.log(“验证码发送返回:”+ res.data);

},

fail: function(res) {

wx.showToast({

title: ‘验证码发送失败’,

icon: ‘none’,

duration: 2000

});

}

})

}

},

2 回复

p30 上也没能复现,升级下微信到7.0.5试试?

你好,麻烦把代码整理成能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

回到顶部