【安卓】button的disabled在调起支付时失效
发布于 6 年前 作者 juanma 5940 次浏览 来自 问答

快速多次点击支付按钮

点击支付按钮后立即将button设置为disabled为true,在ios上生效了,在安卓上会多次调起支付

pay: function (e) {
    let self = this
    self.setData({
      paydisabled: true
    })
    wx.request({
      url: url,
      method: 'GET',
      success: function(res) {
        console.log(res)
        if (res.data.code == 0) {
          let timeStamp = res.data.data.timeStamp.toString()
          let nonceStr = res.data.data.nonceStr
          let pkg = res.data.data.pkg
          let signType = res.data.data.signType
          let paySign = res.data.data.paySign
          wx.requestPayment({
            'timeStamp': timeStamp,
            'nonceStr': nonceStr,
            'package': pkg,
            'signType': signType,
            'paySign': paySign,
            'success':function(res){
              self.setData({
                paydisabled: false
              })
              // dosomething...
            },
            'fail':function(res){
              console.log(res)
              self.setData({
                paydisabled: false
              })
            }
          })
        } else {
          console.log(res.data.message)
        }
      }
    })
  },
回到顶部