dropdown-item.wxml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <wxs module="this" src="./index.wxs" />
  2. <wxs module="_" src="../common/utils.wxs" />
  3. <view
  4. wx:if="{{wrapperVisible}}"
  5. class="{{classPrefix}} {{prefix}}-class"
  6. style="{{this.getStyles(top, zIndex, customStyle)}}"
  7. >
  8. <t-popup
  9. visible="{{show}}"
  10. z-index="{{zIndex + 1}}"
  11. duration="{{duration}}"
  12. show-overlay="{{showOverlay}}"
  13. custom-style="position: absolute;"
  14. overlayProps="{{ { customStyle: 'position: absolute' } }}"
  15. bind:leaved="onLeaved"
  16. bind:visible-change="handleMaskClick"
  17. class="{{classPrefix}}__popup-host"
  18. t-class-content="{{classPrefix}}__content {{prefix}}-class-content"
  19. >
  20. <view class="{{classPrefix}}__body">
  21. <!-- 单选列表 -->
  22. <t-radio-group
  23. wx:if="{{!multiple}}"
  24. class="{{classPrefix}}__radio {{prefix}}-class-column"
  25. t-class="{{classPrefix}}__radio-group"
  26. value="{{value}}"
  27. bind:change="handleRadioChange"
  28. >
  29. <t-radio
  30. wx:for="{{options}}"
  31. wx:key="index"
  32. tabindex="0"
  33. class="{{classPrefix}}__radio-item {{prefix}}-class-column-item"
  34. icon="line"
  35. align="right"
  36. t-class="radio"
  37. t-class-label="{{prefix}}-class-column-item-label"
  38. value="{{item[valueAlias]}}"
  39. label="{{item[labelAlias]}}"
  40. disabled="{{item.disabled}}"
  41. ></t-radio>
  42. </t-radio-group>
  43. <!-- 多选列表 -->
  44. <t-checkbox-group
  45. wx:else
  46. class="{{classPrefix}}__checkbox {{prefix}}-class-column"
  47. t-class="{{classPrefix}}__checkbox-group"
  48. custom-style="grid-template-columns: repeat({{optionsColumns}}, 1fr)"
  49. value="{{value}}"
  50. bind:change="handleRadioChange"
  51. >
  52. <block wx:for="{{options}}" wx:key="index">
  53. <t-checkbox
  54. tabindex="0"
  55. class="{{classPrefix}}__checkbox-item {{prefix}}-class-column-item"
  56. theme="tag"
  57. value="{{item[valueAlias]}}"
  58. label="{{item[labelAlias]}}"
  59. disabled="{{item.disabled}}"
  60. ></t-checkbox>
  61. </block>
  62. </t-checkbox-group>
  63. <slot />
  64. </view>
  65. <view class="{{classPrefix}}__footer {{prefix}}-class-footer" wx:if="{{multiple}}">
  66. <t-button
  67. block
  68. class="{{classPrefix}}__footer-btn {{classPrefix}}__reset-btn"
  69. theme="light"
  70. disabled="{{value.length == 0}}"
  71. bindtap="handleReset"
  72. >重置</t-button
  73. >
  74. <t-button
  75. block
  76. class="{{classPrefix}}__footer-btn {{classPrefix}}__confirm-btn"
  77. theme="primary"
  78. disabled="{{value.length == 0}}"
  79. bindtap="handleConfirm"
  80. >确定</t-button
  81. >
  82. </view>
  83. </t-popup>
  84. </view>