index.wxml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <view
  3. wx:if="{{ showWrapper }}"
  4. class="{{ utils.bem('dropdown-item', direction) }} custom-class"
  5. style="{{ wrapperStyle }}"
  6. >
  7. <van-popup
  8. show="{{ showPopup }}"
  9. custom-style="position: absolute;{{ popupStyle }}"
  10. overlay-style="position: absolute;"
  11. overlay="{{ overlay }}"
  12. position="{{ direction === 'down' ? 'top' : 'bottom' }}"
  13. duration="{{ transition ? duration : 0 }}"
  14. safe-area-tab-bar="{{ safeAreaTabBar }}"
  15. close-on-click-overlay="{{ closeOnClickOverlay }}"
  16. rootPortal="{{ rootPortal }}"
  17. bind:enter="onOpen"
  18. bind:leave="onClose"
  19. bind:close="toggle"
  20. bind:after-enter="onOpened"
  21. bind:after-leave="onClosed"
  22. >
  23. <van-cell
  24. wx:for="{{ options }}"
  25. wx:key="value"
  26. data-option="{{ item }}"
  27. class="{{ utils.bem('dropdown-item__option', { active: item.value === value } ) }}"
  28. clickable
  29. icon="{{ item.icon }}"
  30. bind:tap="onOptionTap"
  31. >
  32. <view
  33. slot="title"
  34. class="van-dropdown-item__title item-title-class"
  35. style="{{ item.value === value ? 'color:' + activeColor : '' }}"
  36. >
  37. {{ item.text }}
  38. </view>
  39. <van-icon
  40. wx:if="{{ item.value === value }}"
  41. name="success"
  42. class="van-dropdown-item__icon"
  43. color="{{ activeColor }}"
  44. />
  45. </van-cell>
  46. <slot />
  47. </van-popup>
  48. </view>