index.wxml 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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: {{ utils.addUnit(height) }}"
  6. >
  7. <scroll-view scroll-y class="van-tree-select__nav">
  8. <van-sidebar active-key="{{ mainActiveIndex }}" bind:change="onClickNav" custom-class="van-tree-select__nav__inner">
  9. <van-sidebar-item
  10. wx:for="{{ items }}"
  11. wx:key="index"
  12. custom-class="main-item-class"
  13. active-class="main-active-class"
  14. disabled-class="main-disabled-class"
  15. badge="{{ item.badge }}"
  16. dot="{{ item.dot }}"
  17. title="{{ item.text }}"
  18. disabled="{{ item.disabled }}"
  19. />
  20. </van-sidebar>
  21. </scroll-view>
  22. <scroll-view scroll-y class="van-tree-select__content">
  23. <slot name="content" />
  24. <view
  25. wx:for="{{ subItems }}"
  26. wx:key="id"
  27. class="van-ellipsis 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' : '' }}"
  28. data-item="{{ item }}"
  29. bind:tap="onSelectItem"
  30. >
  31. {{ item.text }}
  32. <van-icon
  33. wx:if="{{ wxs.isActive(activeId, item.id) }}"
  34. name="{{ selectedIcon }}"
  35. size="16px"
  36. class="van-tree-select__selected"
  37. />
  38. </view>
  39. </scroll-view>
  40. </view>