index.wxml 1.3KB

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