微信小程序方法传参 取参

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
}]
}

你可能感兴趣的:(微信小程序,小程序)