index.wxml 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <wxs src="./index.wxs" module="wxs" />
  3. <view
  4. class="van-tree-select"
  5. style="height: {{ mainHeight }}px"
  6. >
  7. <scroll-view scroll-y class="van-tree-select__nav">
  8. <view
  9. wx:for="{{ items }}"
  10. wx:key="index"
  11. class="van-ellipsis main-item-class {{ utils.bem('tree-select__nitem', { active: mainActiveIndex === index, disabled: item.disabled }) }} {{ mainActiveIndex === index ? 'main-active-class' : '' }} {{ item.disabled ? 'main-disabled-class' : '' }}"
  12. data-index="{{ index }}"
  13. bind:tap="onClickNav"
  14. >
  15. {{ item.text }}
  16. </view>
  17. </scroll-view>
  18. <scroll-view
  19. scroll-y
  20. class="van-tree-select__content"
  21. style="height: {{ itemHeight }}px"
  22. >
  23. <view
  24. wx:for="{{ subItems }}"
  25. wx:key="id"
  26. class="van-ellipsis van-hairline--bottom content-item-class {{ utils.bem('tree-select__item', { active: wxs.isActive(activeId, item.id), disabled: item.disabled }) }} {{ wxs.isActive(activeId, item.id) ? 'content-active-class' : '' }} {{ item.disabled ? 'content-disabled-class' : '' }}"
  27. data-item="{{ item }}"
  28. bind:tap="onSelectItem"
  29. >
  30. {{ item.text }}
  31. <van-icon
  32. wx:if="{{ wxs.isActive(activeId, item.id) }}"
  33. name="checked"
  34. size="16px"
  35. class="van-tree-select__selected"
  36. />
  37. </view>
  38. </scroll-view>
  39. </view>