index.wxml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <view class="custom-class {{ utils.bem('steps', [direction]) }}">
  3. <view class="van-step__wrapper">
  4. <view
  5. wx:for="{{ steps }}"
  6. wx:key="index"
  7. bindtap="onClick"
  8. data-index="{{ index }}"
  9. class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline"
  10. style="{{ status(index, active) === 'inactive' ? 'color: ' + inactiveColor: '' }}"
  11. >
  12. <view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}">
  13. <view>{{ item.text }}</view>
  14. <view class="desc-class">{{ item.desc }}</view>
  15. </view>
  16. <view class="van-step__circle-container">
  17. <block wx:if="{{ index !== active }}">
  18. <van-icon
  19. wx:if="{{ item.inactiveIcon || inactiveIcon }}"
  20. color="{{ status(index, active) === 'inactive' ? inactiveColor: activeColor }}"
  21. name="{{ item.inactiveIcon || inactiveIcon }}"
  22. class="van-step__icon"
  23. />
  24. <view
  25. wx:else
  26. class="van-step__circle"
  27. style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}"
  28. />
  29. </block>
  30. <van-icon wx:else name="{{ item.activeIcon || activeIcon }}" color="{{ activeColor }}" class="van-step__icon" />
  31. </view>
  32. <view
  33. wx:if="{{ index !== steps.length - 1 }}"
  34. class="van-step__line" style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}"
  35. />
  36. </view>
  37. </view>
  38. </view>
  39. <wxs module="status">
  40. function get(index, active) {
  41. if (index < active) {
  42. return 'finish';
  43. } else if (index === active) {
  44. return 'process';
  45. }
  46. return 'inactive';
  47. }
  48. module.exports = get;
  49. </wxs>