云函数删除时报错?
JS页面
deleteImage: function (e) {
var that = this;
var images = that.data.images;
var index = e.currentTarget.dataset.index;//获取当前长按图片下标
wx.showModal({
title: '提示',
content: '确定要删除此图片吗?',
success: function (res) {
if (res.confirm) {
var id = that.data.routers[e.currentTarget.dataset.indexs]._id;
images.splice(index, 1);
//云函数删除
wx.cloud.callFunction({
name: 'pictureDeletion',
data:{
_id:id,
},
success: res => {
console.log(id)
wx.showToast({
title: '[云函数] [pictureDeletion] 删除成功!!',
})
console.log('[云函数] [pictureDeletion] 删除成功!! ', res)
wx.hideLoading();
},
fail: err => {
wx.showToast({
title: '[云函数] [pictureDeletion] 调用失败' + err,
})
console.error('[云函数] [pictureDeletion] 调用失败', err)
}
})
} else if (res.cancel) {
console.log('点击取消了');
return false;
}
that.setData({
routers: images
});
}
})
},
云函数页面
报错原因:
thirdScriptError
Cannot read property ‘4’ of undefined;at api showModal success callback function
TypeError: Cannot read property ‘4’ of undefined
初步判断是这里出错了,具体原因也不清楚呀