template.wxml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <wxs src="../common/utils.wxs" module="_" />
  2. <import src="../common/template/button.wxml" />
  3. <view
  4. class="{{_.cls(classPrefix, [['popup', usePopup]])}} class {{prefix}}-class"
  5. style="{{_._style([style, customStyle])}}"
  6. >
  7. <view class="{{classPrefix}}__title" tabindex="0">
  8. <slot name="title" />
  9. <text>{{ title || '请选择日期' }}</text>
  10. </view>
  11. <t-icon
  12. wx:if="{{usePopup}}"
  13. name="close"
  14. class="{{classPrefix}}__close-btn"
  15. size="24"
  16. aria-role="button"
  17. aria-label="关闭"
  18. bind:tap="handleClose"
  19. />
  20. <view aria-hidden class="{{classPrefix}}__days">
  21. <view wx:for="{{days}}" wx:key="index" class="{{classPrefix}}__days-item">{{ item }}</view>
  22. </view>
  23. <scroll-view
  24. class="{{classPrefix}}__months"
  25. scroll-into-view="{{scrollIntoView}}"
  26. scroll-y
  27. enhanced
  28. show-scrollbar="{{false}}"
  29. >
  30. <block wx:for="{{months}}" wx:key="index">
  31. <view class="{{classPrefix}}__month" id="year_{{item.year}}_month_{{item.month}}"
  32. >{{ item.year }} 年 {{ item.month + 1 }} 月</view
  33. >
  34. <view class="{{classPrefix}}__dates">
  35. <view wx:for="{{(item.weekdayOfFirstDay - firstDayOfWeek + 7) % 7}}" wx:key="index" />
  36. <block wx:for="{{item.months}}" wx:for-index="dateIndex" wx:for-item="dateItem" wx:key="dateIndex">
  37. <view
  38. class="{{classPrefix}}__dates-item {{dateItem.className}} {{classPrefix}}__dates-item--{{dateItem.type}}"
  39. data-year="{{item.year}}"
  40. data-month="{{item.month}}"
  41. data-date="{{dateItem}}"
  42. aria-role="button"
  43. aria-label="{{this.getDateLabel(item, dateItem)}}"
  44. aria-disabled="{{dateItem.type === 'disabled'}}"
  45. bind:tap="handleSelect"
  46. >
  47. <view wx:if="{{dateItem.prefix}}" class="{{classPrefix}}__dates-item-prefix">{{ dateItem.prefix }}</view>
  48. {{ dateItem.day }}
  49. <view
  50. wx:if="{{dateItem.suffix}}"
  51. class="{{classPrefix}}__dates-item-suffix {{classPrefix}}__dates-item-suffix--{{dateItem.type}}"
  52. >
  53. {{ dateItem.suffix }}
  54. </view>
  55. </view>
  56. </block>
  57. </view>
  58. </block>
  59. </scroll-view>
  60. <view wx:if="{{innerConfirmBtn != null && usePopup}}" class="{{classPrefix}}__footer">
  61. <slot wx:if="{{innerConfirmBtn === 'slot'}}" name="confirm-btn" />
  62. <block wx:elif="{{innerConfirmBtn}}">
  63. <!-- <t-button block theme="primary" v-bind="confirmBtn" bind:tap="handleConfirm" /> -->
  64. <template
  65. is="button"
  66. data="{{ block: true, theme: 'primary', class: 't-calendar__confirm-btn', ...innerConfirmBtn }}"
  67. />
  68. </block>
  69. </view>
  70. </view>