index.wxml 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <view class="van-picker custom-class">
  2. <view
  3. wx:if="{{ showToolbar }}"
  4. class="van-picker__toolbar van-hairline--top-bottom toolbar-class"
  5. >
  6. <view
  7. class="van-picker__cancel"
  8. hover-class="van-picker__cancel--hover"
  9. hover-stay-time="70"
  10. data-type="cancel"
  11. bindtap="emit"
  12. >
  13. {{ cancelButtonText }}
  14. </view>
  15. <view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ title }}</view>
  16. <view
  17. class="van-picker__confirm"
  18. hover-class="van-picker__confirm--hover"
  19. hover-stay-time="70"
  20. data-type="confirm"
  21. bindtap="emit"
  22. >
  23. {{ confirmButtonText }}
  24. </view>
  25. </view>
  26. <view wx:if="{{ loading }}" class="van-picker__loading">
  27. <loading color="#1989fa"/>
  28. </view>
  29. <view
  30. class="van-picker__columns"
  31. style="height: {{ itemHeight * visibleItemCount }}px"
  32. catch:touchmove="noop"
  33. >
  34. <picker-column
  35. class="van-picker__column"
  36. wx:for="{{ isSimple(columns) ? [columns] : columns }}"
  37. wx:key="{{ index }}"
  38. data-index="{{ index }}"
  39. custom-class="column-class"
  40. value-key="{{ valueKey }}"
  41. initial-options="{{ isSimple(columns) ? item : item.values }}"
  42. default-index="{{ item.defaultIndex || defaultIndex }}"
  43. item-height="{{ itemHeight }}"
  44. visible-item-count="{{ visibleItemCount }}"
  45. active-class="active-class"
  46. bind:change="onChange"
  47. />
  48. <view
  49. class="van-picker__frame van-hairline--top-bottom"
  50. style="height: {{ itemHeight }}px"
  51. />
  52. </view>
  53. </view>
  54. <wxs module="isSimple">
  55. function isSimple(columns) {
  56. return columns.length && !columns[0].values;
  57. }
  58. module.exports = isSimple;
  59. </wxs>