diff --git a/template/uni-app/components/productWindow/index.vue b/template/uni-app/components/productWindow/index.vue index bdcd5758c..2638d9544 100644 --- a/template/uni-app/components/productWindow/index.vue +++ b/template/uni-app/components/productWindow/index.vue @@ -151,7 +151,7 @@ * */ bindCode: function(e) { - this.$emit('iptCartNum', this.attr.productSelect.cart_num); + this.$emit('iptCartNum', e); }, closeAttr: function() { this.$emit('myevent'); diff --git a/template/uni-app/pages/goods_details/index.vue b/template/uni-app/pages/goods_details/index.vue index 43c91200c..7591d087e 100644 --- a/template/uni-app/pages/goods_details/index.vue +++ b/template/uni-app/pages/goods_details/index.vue @@ -806,7 +806,15 @@ * */ iptCartNum: function(e) { - this.$set(this.attr.productSelect, "cart_num", e); + if (e) { + let number = 1 + if (Number.isInteger(parseInt(e)) && parseInt(e) > 0) { + number = parseInt(e); + } + this.$nextTick(e => { + this.$set(this.attr.productSelect, "cart_num", e < 0 ? 1 : number); + }) + } }, // 后退 returns() {