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)))