index.wxml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template name="datepicker">
  2. <view class="datepicker-bg" wx:if="{{showDatePicker}}" bindtap="closeDatePicker"></view>
  3. <input
  4. wx:if="{{showInput}}"
  5. class="datepicker-input"
  6. placeholder="{{placeholder}}"
  7. value="{{selectedValue || ''}}"
  8. type="text"
  9. bindinput="onInputDate"
  10. bindfocus="showDatepicker"/>
  11. <view wx:if="{{showDatePicker}}" class="datepicker-wrap flex box box-tb box-align-center">
  12. <view class="calendar pink-color box box-tb">
  13. <view class="top-handle fs28 box box-lr box-align-center box-pack-center">
  14. <view class="prev box box-rl" catchtap="handleCalendar" data-handle="prev">
  15. <view class="prev-handle box box-lr box-align-center box-pack-center">《</view>
  16. </view>
  17. <view class="date-area box box-lr box-align-center box-pack-center">{{curYear || "--"}} 年 {{curMonth || "--"}} 月</view>
  18. <view class="next box box-lr" catchtap="handleCalendar" data-handle="next">
  19. <view class="next-handle box box-lr box-align-center box-pack-center">》</view>
  20. </view>
  21. </view>
  22. <view wx:if="{{weeksCh}}" class="weeks box box-lr box-pack-center box-align-center">
  23. <view class="flex week fs28" wx:for="{{weeksCh}}" wx:key="{{index}}" data-idx="{{index}}">{{item}}</view>
  24. </view>
  25. <view class="days box box-lr box-wrap" bindtouchstart="datepickerTouchstart" bindtouchmove="datepickerTouchmove">
  26. <view wx:if="{{empytGrids}}" class="grid disable-day-color box box-align-center box-pack-center"
  27. wx:for="{{empytGrids}}"
  28. wx:key="{{index}}"
  29. data-idx="{{index}}">
  30. <view class="day box box-align-center box-pack-center">{{item}}</view>
  31. </view>
  32. <view class="grid normal-day-color box box-align-center box-pack-center"
  33. wx:for="{{days}}"
  34. wx:key="{{index}}"
  35. data-idx="{{index}}"
  36. data-disable="{{item.disable}}"
  37. catchtap="tapDayItem">
  38. <view class="day border-radius {{item.choosed ? 'day-choosed-color pink-bg' : ''}} {{ item.disable ? 'disable-day-color disable-day-circle' : '' }} box box-align-center box-pack-center">{{item.day}}</view>
  39. </view>
  40. <view class="grid disable-day-color box box-align-center box-pack-center"
  41. wx:for="{{lastEmptyGrids}}"
  42. wx:key="{{index}}"
  43. data-idx="{{index}}">
  44. <view class="day box box-align-center box-pack-center">{{item}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>