Fix:没有优惠券时最大值计算报错
This commit is contained in:
@@ -157,8 +157,10 @@ export default {
|
|||||||
return maxIndex
|
return maxIndex
|
||||||
},
|
},
|
||||||
largOne() {
|
largOne() {
|
||||||
this.selectCoupon(this.list[this.maxIndex].id)
|
if(this.list[this.maxIndex]) {
|
||||||
return this.list[this.maxIndex]
|
this.selectCoupon(this.list[this.maxIndex].id)
|
||||||
|
}
|
||||||
|
return this.list[this.maxIndex] || {}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -171,7 +173,7 @@ export default {
|
|||||||
},
|
},
|
||||||
selectCoupon(id) {
|
selectCoupon(id) {
|
||||||
this.couponId = 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 => {
|
this.list.map(item => {
|
||||||
item.checked = id === item.id
|
item.checked = id === item.id
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user