calendar.wxml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <import src="../common/template/button.wxml" />
  2. <view>
  3. <t-popup visible="{{visible}}" bind:visible-change="handleClose" placement="bottom">
  4. <view class="{{name}}">
  5. <view class="{{name}}__title">
  6. <slot wx:if="{{title === 'slot'}}" name="title" />
  7. <text wx:else>{{ title || '请选择日期' }}</text>
  8. </view>
  9. <t-icon name="close" class="{{name}}__close-btn" size="24" bind:tap="handleClose" />
  10. <view class="{{name}}__days">
  11. <view wx:for="{{days}}" wx:key="index" class="{{name}}__days-item">{{ item }}</view>
  12. </view>
  13. <view class="{{name}}__months">
  14. <block wx:for="{{months}}" wx:key="index">
  15. <view class="{{name}}__month">{{ item.year }} 年 {{ item.month + 1 }} 月</view>
  16. <view class="{{name}}__dates">
  17. <block wx:for="{{item.months}}" wx:for-index="dateIndex" wx:for-item="dateItem" wx:key="dateIndex">
  18. <view
  19. class="{{name}}__dates-item {{dateItem.className}} {{name}}__dates-item--{{dateItem.type}}"
  20. style="margin-left: {{dateIndex === 0 ? 49 * ((item.weekdayOfFirstDay - firstDayOfWeek + 7) % 7) + 'px' : 0}}"
  21. data-year="{{item.year}}"
  22. data-month="{{item.month}}"
  23. data-date="{{dateItem}}"
  24. bind:tap="handleSelect"
  25. >
  26. <view wx:if="{{dateItem.prefix}}" class="{{name}}__dates-item-prefix">{{ dateItem.prefix }}</view>
  27. {{ dateItem.day }}
  28. <view
  29. wx:if="{{dateItem.suffix}}"
  30. class="{{name}}__dates-item-suffix {{name}}__dates-item-suffix--{{dateItem.type}}"
  31. >
  32. {{ dateItem.suffix }}
  33. </view>
  34. </view>
  35. </block>
  36. </view>
  37. </block>
  38. </view>
  39. <view class="{{name}}__footer">
  40. <slot wx:if="{{confirmBtn === 'slot'}}" name="confirmBtn" />
  41. <block wx:elif="{{confirmBtn}}">
  42. <!-- <t-button block theme="primary" v-bind="confirmBtn" bind:tap="handleConfirm" /> -->
  43. <template
  44. is="button"
  45. data="{{...confirmBtn, block: true, theme: 'primary', class: 't-calendar__confirm-btn' }}"
  46. />
  47. </block>
  48. </view>
  49. </view>
  50. </t-popup>
  51. </view>