Skip to content

Commit

Permalink
fix(rate): when value = 0, default-value != 0, allow-half = true, the…
Browse files Browse the repository at this point in the history
… effect is abnormal (#2307)
  • Loading branch information
betavs committed Aug 21, 2023
1 parent cdce071 commit 03d38c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rate/rate.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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');
Expand Down

0 comments on commit 03d38c8

Please sign in to comment.