From e859489ee9ef74b96c9546e98b05ed505eff1bcc Mon Sep 17 00:00:00 2001 From: betavs <392368711@qq.com> Date: Mon, 21 Aug 2023 17:40:15 +0800 Subject: [PATCH] fix(rate): when value = 0, default-value != 0, allow-half = true, the effect is abnormal --- src/rate/rate.wxs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rate/rate.wxs b/src/rate/rate.wxs index d799da422..8387b108b 100644 --- a/src/rate/rate.wxs +++ b/src/rate/rate.wxs @@ -8,7 +8,7 @@ module.exports = { }, getIconName: function (defaultValue, value, index, icon) { - var curVal = value ? value : defaultValue; + var curVal = value >= 0 ? value : defaultValue; var name = ['star-filled', 'star-filled']; if (icon) { @@ -19,7 +19,7 @@ module.exports = { }, getIconClass: function (classPrefix, defaultValue, value, index, allowHalf, disabled, scaleIndex) { - var curVal = value ? value : defaultValue; + var curVal = value >= 0 ? value : defaultValue; var className = []; if (curVal >= index + 1) { className.push(classPrefix + '--selected');