index.wxml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 }}"
  31. class="van-step__icon"/>
  32. </view>
  33. <view
  34. wx:if="{{ index !== steps.length - 1 }}"
  35. class="van-step__line"
  36. style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}"
  37. />
  38. </view>
  39. </view>
  40. </view>
  41. <wxs module="status">
  42. function get(index, active) {
  43. if (index < active) {
  44. return 'finish';
  45. } else if (index === active) {
  46. return 'process';
  47. }
  48. return 'inactive';
  49. }
  50. module.exports = get;
  51. </wxs>