diff --git a/src/components/checkbox-group/checkbox-group.vue b/src/components/checkbox-group/checkbox-group.vue index e5b44f0edb64a3fa9d1eec8e1478d6b8ff05b784..f0f7beb2655ceceb046e9e5e0e59cef2ccb6691e 100644 --- a/src/components/checkbox-group/checkbox-group.vue +++ b/src/components/checkbox-group/checkbox-group.vue @@ -81,14 +81,14 @@ }, mounted () { this.$on(EVENT_CHECKED, (value) => { - if (this._value.length < this.max) { + if (this._value.length < this.max && this._value.indexOf(value) === -1) { this._value.push(value) } this.$emit(EVENT_INPUT, this._value) }) this.$on(EVENT_CANCLE_CHECKED, (value) => { - if (this._value.length > this.min) { - const index = this._value.indexOf(value) + const index = this._value.indexOf(value) + if (this._value.length > this.min && index > -1) { this._value.splice(index, 1) } this.$emit(EVENT_INPUT, this._value) diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue index be3ac432cdab965b5b85a43c3511eb93fb3c2010..a6c98ad7a4b430d6b0a186a8eed8ab17278c4444 100644 --- a/src/components/checkbox/checkbox.vue +++ b/src/components/checkbox/checkbox.vue @@ -92,9 +92,11 @@ set (newValue) { const value = this.computedOption.value const emitValue = value && newValue ? value : newValue - const parentEmitEvent = newValue ? EVENT_CHECKED : EVENT_CANCLE_CHECKED this.$emit(EVENT_INPUT, emitValue) if (this.isInGroup) { + // fix a bug when checkboxgroup set the min props + newValue = !this.checkValue + const parentEmitEvent = newValue ? EVENT_CHECKED : EVENT_CANCLE_CHECKED this.$parent.$emit(parentEmitEvent, value || newValue) } }