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')
}
}
})
Read More:
- Vue error in render: “typeerror: cannot read property ‘length’ of undefined”
- [Solved] Vue + uniapp Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- [Solved] TypeError: Cannot read property ‘indexOf‘ of undefined at VueComponent.resetFields
- [Solved] Vue Error: Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- [Vue warn]: Error in render: TypeError: Cannot read property ‘xxxx’of undefined
- [Solved] VUE Use Filters Error: [Vue warn]: Error in render: “TypeError: Cannot read property ‘toFixed’ of undefined”
- Uniapp: TypeError: Cannot read property ‘apply‘ of undefined (H5 does not report an error, but the real machine runs with an error)
- [Solved] Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined
- Can’t read property ‘push’ of undefined [How to Solve]
- cesium CLAMP_TO_GROUND Error Cannot read property ‘globe‘ of undefined
- [Solved] Parcel Package Error: Cannot read property ‘length‘ of undefined
- [Solved] Echarts Error: Cannot read property ‘init‘ of undefined
- Vue Error in callback for immediate watcher “height”: “TypeError: Cannot read property ‘style’ of
- VUE Echarts Loading Error TypeError: Cannot read property getAttribute of null?
- Vue ElementUI el-dropdown Error: Uncaught TypeError: Cannot read property ‘disabled‘ of null
- [Solved] vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: “TypeError: Cannot read property ‘length‘
- openlayers — Cannot read property ‘slice‘ of null—Map cannot be loaded
- El-cascader error: Cannot read property’level’ of null