template.wxml 2.6 KB

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