Questions
In the custom click event function, there is an error calling SetData, indicating that it is undefined
reason
The current this refers to the instance object of the success function
delTaskTap(e){
wx.showModal({
title:'Tips',
content:'Do I have to clear all my to-do lists?',
success:function(res){
if(res.confirm){
this.setData({
taskText:[]
})
console.log('Clear all to-do items')
}
else if(res.cancel){
console.log('Not clearing all to-do items')
}
}
})
terms of settlement
delTaskTap(e){
var that=this
wx.showModal({
title:'Tips',
content:'Do I have to clear all my to-do lists?',
success:function(res){
if(res.confirm){
that.setData({
taskText:[]
})
console.log('Clear all to-do items')
}
else if(res.cancel){
console.log('Not clearing all to-do items')
}
}
})