index.wxml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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;"
  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:close="onClickOverlay"
  16. >
  17. <van-cell
  18. wx:for="{{ options }}"
  19. wx:key="{{ item.value }}"
  20. data-option="{{ item }}"
  21. class="{{ utils.bem('dropdown-item__option', { active: item.value === value } ) }}"
  22. clickable
  23. icon="{{ item.icon }}"
  24. bind:tap="onOptionTap"
  25. >
  26. <view
  27. slot="title"
  28. class="van-dropdown-item__title"
  29. style="{{ item.value === value ? 'color:' + activeColor : '' }}"
  30. >
  31. {{ item.text }}
  32. </view>
  33. <van-icon
  34. wx:if="{{ item.value === value }}"
  35. name="success"
  36. class="van-dropdown-item__icon"
  37. color="{{ activeColor }}"
  38. />
  39. </van-cell>
  40. <slot />
  41. </van-popup>
  42. </view>