signed

QiShunwang

“诚信为本、客户至上”

微信小程序方法传参 取参

2021/4/26 21:05:50   来源:

js


  delete(event){
    console.log(event.currentTarget.id),
    wx.request({
      url:that.data.url+'/api/ibeacon/deleteDevice',
      data:{
        ibeaconName:this.data.uuid[event.currentTarget.id].ibeaconName
      },
      header:{
        'content-type': 'application/x-www-form-urlencoded'
      },
      method:'POST',
      success: function(res){
        wx.showToast({
          title: '删除成功'
      })
      setTimeout(function () {
          wx.reLaunch({
            url: '../myIbeacon/myIbeacon',
          })
         }, 1500) //延迟时间 这里是1.5秒
        
      } 
    })
  }

wxml

<button bindtap="delete" id="{{index}}">删除</button>
{
"type":"tap",
"timeStamp":895,
"target": {
  "id": "tapTest",
  "dataset":  {
    "hi":"WeChat"
  }
},
"currentTarget":  {
  "id": "tapTest",
  "dataset": {
    "hi":"WeChat"
  }
},
"detail": {
  "x":53,
  "y":14
},
"touches":[{
  "identifier":0,
  "pageX":53,
  "pageY":14,
  "clientX":53,
  "clientY":14
}],
"changedTouches":[{
  "identifier":0,
  "pageX":53,
  "pageY":14,
  "clientX":53,
  "clientY":14
}]
}