diff --git a/src/components/rate/rate.vue b/src/components/rate/rate.vue index 0f23245e..ceacb03b 100644 --- a/src/components/rate/rate.vue +++ b/src/components/rate/rate.vue @@ -45,6 +45,10 @@ }, name: { type: String + }, + allowClear: { + type: Boolean, + default: false } }, data () { @@ -123,8 +127,13 @@ }, handleClick (value) { if (this.disabled) return; -// value++; + //value++; if (this.isHalf) value -= 0.5; + + if(this.allowClear && Math.abs(value - this.currentValue) < 0.01) { + value = 0; + } + this.currentValue = value; this.$emit('input', value); this.$emit('on-change', value);