From a5d0ce8657aebbce303a79ef866ebbc7c719aa67 Mon Sep 17 00:00:00 2001 From: modendeveloper Date: Tue, 8 Apr 2025 23:45:38 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A3601=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=E5=8A=A0=E8=B4=AD=E6=88=96?= =?UTF-8?q?=E9=80=81=E7=A4=BC=EF=BC=8C=E8=BE=93=E5=85=A5=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E8=B6=85=E8=BF=87=E5=95=86=E5=93=81=E5=BA=93=E5=AD=98=EF=BC=8C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=82=B9=E5=87=BB=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ProductWindow.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/ProductWindow.vue b/components/ProductWindow.vue index 8e53443..2bb0b9b 100644 --- a/components/ProductWindow.vue +++ b/components/ProductWindow.vue @@ -138,7 +138,10 @@ export default { deep: true }, cartNumber(val) { - console.log(+val <= 1 || val === '', 'cartNumber'); + console.log(this.attr, 'cartNumber'); + if (val > this.attrObj.productSelect.stock) { + val = this.attrObj.productSelect.stock + } this.$emit('input', +val) this.$emit("changeFun", { action: "ChangeCartNum", value: +val }) } @@ -154,6 +157,10 @@ export default { this.cartNumber = 1 this.$forceUpdate() } + if(+e > this.attrObj.productSelect.stock) { + this.cartNumber = this.attrObj.productSelect.stock + this.$forceUpdate() + } }, reRender(data) { this.$set(this, 'attrObj', JSON.parse(JSON.stringify(data)))