From 15e52bfefed22717e245dc2ac86f4f24bd4bf312 Mon Sep 17 00:00:00 2001 From: linxi Date: Fri, 1 Aug 2025 11:53:00 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A3880=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E6=90=9C=E7=B4=A2=E7=95=8C?= =?UTF-8?q?=E9=9D=A2-=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81=E5=88=B0?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=EF=BC=8C=E7=BA=A2=E7=82=B9=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=9C=AA=E5=8F=8A=E6=97=B6=E5=90=8C=E6=AD=A5=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mixins/goCartMixins.js | 5 +++-- pages/shop/GoodsList/index.vue | 5 +---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mixins/goCartMixins.js b/mixins/goCartMixins.js index d41ebe0..6b84eef 100644 --- a/mixins/goCartMixins.js +++ b/mixins/goCartMixins.js @@ -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 diff --git a/pages/shop/GoodsList/index.vue b/pages/shop/GoodsList/index.vue index 30308fc..bcf6bba 100644 --- a/pages/shop/GoodsList/index.vue +++ b/pages/shop/GoodsList/index.vue @@ -175,7 +175,7 @@ :cartNum="cart_num" :showOk="true" @changeFun="changeFun" - @ok="handleOk(getCartCount())" + @ok="handleOk(() => this.getCartCount())" /> @@ -188,9 +188,6 @@ import NP from 'number-precision' import NoGoodData from '@/components/good/NoData' import Recommend from '@/components/Recommend' import goCartMixin from '@/mixins/goCartMixins' -import { - getCartCount, -} from '@/api/store' export default { name: 'GoodsList', components: {