An error handling problem:
Error in callback for watcher "checkList": "TypeError: Cannot read property
handler:(val,oldVal)=>{}
This will report an error. The arrow function causes this to point to an error. Change it to handler:function(val,oldVal){}.
watch:{
checkList:{
handler:(oldValue,newValue) => {
let _sum = 0
this.orderData.forEach(item => {
if(this.checkList[item.order_id]){
_sum += item.service_price
}
})
this.sum = _sum
},
deep:true
}
},
If you write like the above, you will get an error, just change it to the following, don’t use arrow functions
watch:{
checkList:{
handler:function(oldValue,newValue){
let _sum = 0
this.orderData.forEach(item => {
if(this.checkList[item.order_id]){
_sum += item.service_price
}
})
this.sum = _sum
},
deep:true
}
},