index.wxml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <wxs src="./index.wxs" module="utils" />
  2. <view wx:if="{{ showHeader }}" class="van-cascader__header">
  3. <slot name="title" wx:if="{{ useTitleSlot }}"></slot>
  4. <text class="van-cascader__title" wx:else>{{ title }}</text>
  5. <van-icon
  6. wx:if="{{ closeable }}"
  7. name="{{ closeIcon }}"
  8. class="van-cascader__close-icon"
  9. bind:tap="onClose"
  10. />
  11. </view>
  12. <van-tabs
  13. active="{{ activeTab }}"
  14. custom-class="van-cascader__tabs"
  15. wrap-class="van-cascader__tabs-wrap"
  16. tab-class="van-cascader__tab"
  17. color="{{ activeColor }}"
  18. border="{{ false }}"
  19. swipeable="{{ swipeable }}"
  20. bind:click="onClickTab"
  21. >
  22. <van-tab
  23. wx:for="{{ tabs }}"
  24. wx:for-item="tab"
  25. wx:for-index="tabIndex"
  26. wx:key="tabIndex"
  27. title="{{ tab.selected ? tab.selected[textKey] : placeholder }}"
  28. style="width: 100%;"
  29. title-style="{{ !tab.selected ? 'color: #969799;font-weight:normal;' : '' }}"
  30. >
  31. <!-- 暂不支持 -->
  32. <!-- <slot name="options-top"></slot> -->
  33. <view class="van-cascader__options">
  34. <view
  35. wx:for="{{ tab.options }}"
  36. wx:for-item="option"
  37. wx:key="index"
  38. class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}"
  39. style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
  40. data-option="{{ option }}"
  41. data-tab-index="{{ tabIndex }}"
  42. bind:tap="onSelect"
  43. >
  44. <text>{{ option[textKey] }}</text>
  45. <van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
  46. </view>
  47. </view>
  48. <!-- 暂不支持 -->
  49. <!-- <slot name="options-bottom"></slot> -->
  50. </van-tab>
  51. </van-tabs>