index.wxml 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <view
  3. wx:if="{{ showWrapper }}"
  4. class="{{ utils.bem('dropdown-item', direction) }}"
  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. close-on-click-overlay="{{ closeOnClickOverlay }}"
  15. bind:enter="onOpen"
  16. bind:leave="onClose"
  17. bind:close="toggle"
  18. bind:after-enter="onOpened"
  19. bind:after-leave="onClosed"
  20. >
  21. <van-cell
  22. wx:for="{{ options }}"
  23. wx:key="value"
  24. data-option="{{ item }}"
  25. class="{{ utils.bem('dropdown-item__option', { active: item.value === value } ) }}"
  26. clickable
  27. icon="{{ item.icon }}"
  28. bind:tap="onOptionTap"
  29. >
  30. <view
  31. slot="title"
  32. class="van-dropdown-item__title"
  33. style="{{ item.value === value ? 'color:' + activeColor : '' }}"
  34. >
  35. {{ item.text }}
  36. </view>
  37. <van-icon
  38. wx:if="{{ item.value === value }}"
  39. name="success"
  40. class="van-dropdown-item__icon"
  41. color="{{ activeColor }}"
  42. />
  43. </van-cell>
  44. <slot />
  45. </van-popup>
  46. </view>