Fix:没有优惠券时最大值计算报错

This commit is contained in:
linxi
2024-09-18 16:11:25 +08:00
parent d3d22a3c87
commit edcb64fbf6
+5 -3
View File
@@ -157,8 +157,10 @@ export default {
return maxIndex
},
largOne() {
this.selectCoupon(this.list[this.maxIndex].id)
return this.list[this.maxIndex]
if(this.list[this.maxIndex]) {
this.selectCoupon(this.list[this.maxIndex].id)
}
return this.list[this.maxIndex] || {}
}
},
@@ -171,7 +173,7 @@ export default {
},
selectCoupon(id) {
this.couponId = id
this.selectItem = this.list.find(e => e.id === id)
this.selectItem = this.list.find(e => e.id === id) || {}
this.list.map(item => {
item.checked = id === item.id
})