tree-select.wxml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <wxs module="_" src="../common/utils.wxs" />
  2. <wxs module="this" src="./index.wxs" />
  3. <view class="{{classPrefix}}" style="height: {{_.addUnit(height)}}; {{customStyle}}">
  4. <scroll-view
  5. scroll-y
  6. enhanced
  7. show-scrollbar="{{false}}"
  8. class="{{_.cls(classPrefix + '__column', [this.getTreeClass(leafLevel - level, treeOptions.length)])}} {{prefix}}-class"
  9. wx:for="{{treeOptions}}"
  10. wx:key="level"
  11. wx:for-index="level"
  12. >
  13. <t-side-bar
  14. wx:if="{{level == 0}}"
  15. value="{{value[level]}}"
  16. bind:change="onRootChange"
  17. t-class="{{classPrefix}}-column {{prefix}}-class-left-column"
  18. >
  19. <t-side-bar-item
  20. wx:for="{{treeOptions[level]}}"
  21. wx:key="index"
  22. label="{{item[labelAlias]}}"
  23. value="{{item[valueAlias]}}"
  24. t-class="{{prefix}}-class-left-item"
  25. />
  26. </t-side-bar>
  27. <block wx:elif="{{level != leafLevel}}">
  28. <view
  29. wx:for="{{treeOptions[level]}}"
  30. wx:key="index"
  31. bind:tap="handleTreeClick"
  32. data-level="{{level}}"
  33. data-value="{{item[valueAlias]}}"
  34. class="{{_.cls(classPrefix + '__item', [['active', item[valueAlias] === value[level]]])}} {{prefix}}-class-middle-item"
  35. >
  36. {{item[labelAlias]}}
  37. </view>
  38. </block>
  39. <t-radio-group
  40. wx:elif="{{!multiple}}"
  41. class="{{classPrefix}}__radio {{prefix}}-class-right-column"
  42. data-level="{{level}}"
  43. value="{{value[level]}}"
  44. bind:change="handleRadioChange"
  45. >
  46. <t-radio
  47. wx:for="{{treeOptions[level]}}"
  48. wx:key="value"
  49. icon="line"
  50. class="{{classPrefix}}__radio-item {{prefix}}-class-right-item"
  51. t-class-label="{{prefix}}-class-right-item-label"
  52. value="{{item[valueAlias]}}"
  53. borderless
  54. align="right"
  55. >{{item[labelAlias]}}</t-radio
  56. >
  57. </t-radio-group>
  58. <t-checkbox-group
  59. wx:else
  60. class="{{classPrefix}}__checkbox {{prefix}}-class-right-column"
  61. value="{{value[level]}}"
  62. bind:change="handleRadioChange"
  63. data-level="{{level}}"
  64. >
  65. <t-checkbox
  66. wx:for="{{treeOptions[level]}}"
  67. wx:key="value"
  68. align="right"
  69. icon="line"
  70. class="{{prefix}}-class-right-item"
  71. t-class-label="{{prefix}}-class-right-item-label"
  72. borderless
  73. value="{{item[valueAlias]}}"
  74. >{{item[labelAlias]}}</t-checkbox
  75. >
  76. </t-checkbox-group>
  77. </scroll-view>
  78. </view>