index.wxml 907B

123456789101112131415161718192021222324252627282930313233
  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="font-size: {{ size}}px;"
  11. >
  12. <van-icon
  13. name="{{ index + 1 <= innerValue ? icon : voidIcon }}"
  14. class="van-rate__icon"
  15. custom-class="icon-class"
  16. data-score="{{ index }}"
  17. color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}"
  18. bind:click="onSelect"
  19. />
  20. <van-icon
  21. wx:if="{{ allowHalf }}"
  22. name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}"
  23. class="{{ utils.bem('rate__icon', ['half']) }}"
  24. custom-class="icon-class"
  25. data-score="{{ index - 0.5 }}"
  26. color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}"
  27. bind:click="onSelect"
  28. />
  29. </view>
  30. </view>