From 1137640c3da9a66e8ef96c291518957adf4349cd Mon Sep 17 00:00:00 2001 From: xiaofengsha <181347204@qq.com> Date: Thu, 26 Apr 2018 01:00:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?rate=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0all?= =?UTF-8?q?owClear=E5=B1=9E=E6=80=A7=EF=BC=8C=E9=80=9A=E8=BF=87=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=8F=AF=E4=BB=A5=E6=8A=8A=E5=BD=93=E5=89=8D=E8=AF=84?= =?UTF-8?q?=E5=88=86=E6=B8=85=E9=9B=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/rate/rate.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); From 522589820221cbaa7a8614637c7a5619dc3770fe Mon Sep 17 00:00:00 2001 From: xiaofengsha <181347204@qq.com> Date: Thu, 26 Apr 2018 01:01:52 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0tag=E7=BB=84=E4=BB=B6allo?= =?UTF-8?q?wClear=E5=B1=9E=E6=80=A7=E7=9A=84=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/routers/rate.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/routers/rate.vue b/examples/routers/rate.vue index 8f2d6438..8bccc6ed 100644 --- a/examples/routers/rate.vue +++ b/examples/routers/rate.vue @@ -2,6 +2,8 @@