deleteout:function(e){
const db=wx.cloud.database()
var that=this;
var id;
var money;
var outcome=that.data.outcome;
let data=e.currentTarget.dataset.data;
console.log(data)
var index=e.currentTarget.dataset.index;//获取选中记录的索引
id=that.data.outcome[index]._id;//获取选中记录的_id
money=that.data.outcome[index].jine;
console.log(id)
wx.showModal({
title: '提示',
content:'确认要删除吗',
success:function(res){
if(res.confirm){
db.collection('outcome_list').doc(id).remove()//根据记录的id进行删除
wx.cloud.callFunction({
name:"remove",
data:{
_id:id,
},
success:res=>{
outcome.splice(index,1)
that.setData({
outcome:outcome,
jine1:that.data.jine1-money
})
console.log(id)
}
})
}
}
})
},
小程序云开发删除用户选定的记录
最新推荐文章于 2022-03-30 21:47:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)