template.wxml 2.6 KB

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