index.wxml 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <view class="van-picker">
  2. <view wx:if="{{ showToolbar }}" class="van-picker__toolbar van-hairline--bottom">
  3. <view class="van-picker__cancel" bindtap="onCancel">{{ cancelButtonText }}</view>
  4. <view class="van-picker__title">{{ title }}</view>
  5. <view class="van-picker__confirm" bindtap="onConfirm">{{ confirmButtonText }}</view>
  6. </view>
  7. <view wx:if="{{ loading }}" class="van-picker__loading">
  8. <van-loading color="#1989fa"/>
  9. </view>
  10. <picker-view
  11. indicator-style="height: {{ itemHeight }}px;"
  12. style="width: 100%; height: {{ itemHeight * visibleItemCount + 'px' }}"
  13. bindchange="onChange"
  14. value="{{ pickerValue }}"
  15. class="van-picker__columns"
  16. >
  17. <picker-view-column
  18. wx:for="{{ columns }}"
  19. wx:for-item="row"
  20. wx:for-index="rowIndex"
  21. wx:key="rowIndex"
  22. class="van-picker-column"
  23. >
  24. <view
  25. wx:for="{{ row }}"
  26. wx:key="{{ item }}"
  27. style="line-height: {{ itemHeight }}px;"
  28. class="van-picker-column__item {{ index === pickerValue[rowIndex] ? 'van-picker-column__item--selected' : '' }}"
  29. >{{ item }}</view>
  30. </picker-view-column>
  31. </picker-view>
  32. </view>