Fix:3880 【商城小程序】搜索界面-增加商品到购物车,红点提示未及时同步更新数量

This commit is contained in:
linxi
2025-08-01 11:53:00 +08:00
parent ea9e442e9b
commit 15e52bfefe
2 changed files with 4 additions and 6 deletions
+3 -2
View File
@@ -46,6 +46,7 @@ export default {
numType: 0
}).then(res => {
this.CartCount = res.data.count
this.$forceUpdate()
})
}
},
@@ -112,7 +113,7 @@ export default {
const onlyOne = Object.keys(data.productValue).length === 1
if(onlyOne) {
this.handleOk(this.getCartCount())
this.handleOk(() => this.getCartCount())
return
}
this.attr.cartAttr = !this.isOpen ? true : false
@@ -245,7 +246,7 @@ export default {
},
handleOk(cb = '') {
handleOk(cb) {
const productSelect = this.getAttrItemData(this.attrValue)
// 如果有属性,没有选择,提示用户选择
const hasNo = (this.attr.productAttr.length && productSelect === undefined && this.isOpen) || productSelect.stock === 0