From 8341d332e7e151d00922557c58bbc8d788ce7e4a Mon Sep 17 00:00:00 2001 From: liaohainan Date: Wed, 16 Nov 2022 00:16:27 +0800 Subject: [PATCH] feat(rate): del invalid code --- packages/quark/src/rate/index.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/quark/src/rate/index.tsx b/packages/quark/src/rate/index.tsx index 86f9ef16..367e9193 100644 --- a/packages/quark/src/rate/index.tsx +++ b/packages/quark/src/rate/index.tsx @@ -68,13 +68,9 @@ class QuarkRate extends QuarkElement { handleChange(i: { id: number; color: string }) { if (!this.shadowRoot) return; - const { id, color } = i; + const { id } = i; this.stars = this.stars.map((item) => { - item.color = "inherit"; - if (color === this.activecolor) { - item.color = "inherit"; - } - if (item.id <= id) item.color = this.activecolor; + item.color = item.id <= id ? this.activecolor : "inherit"; return item; }); const value = this.stars.filter((i) => i.color === this.activecolor).length;