index.wxml 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <view
  3. class="van-rate custom-class"
  4. bind:touchmove="onTouchMove"
  5. >
  6. <view
  7. class="van-rate__item"
  8. wx:for="{{ count }}"
  9. wx:key="index"
  10. style="padding-right: {{ index !== count - 1 ? gutterWithUnit : '' }}"
  11. >
  12. <van-icon
  13. name="{{ index + 1 <= innerValue ? icon : voidIcon }}"
  14. class="van-rate__icon"
  15. style="font-size :{{ size? sizeWithUnit : ''}}"
  16. custom-class="icon-class"
  17. data-score="{{ index }}"
  18. color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}"
  19. bind:click="onSelect"
  20. />
  21. <van-icon
  22. wx:if="{{ allowHalf }}"
  23. name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}"
  24. class="{{ utils.bem('rate__icon', ['half']) }}"
  25. style="font-size :{{ size? sizeWithUnit : ''}}"
  26. custom-class="icon-class"
  27. data-score="{{ index - 0.5 }}"
  28. color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}"
  29. bind:click="onSelect"
  30. />
  31. </view>
  32. </view>