calendar.wxml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <wxs module="rangeStyle">
  2. var handle = function(day, dateRange) {
  3. if (dateRange.indexOf(day.date) !== -1) return 'range-pick';
  4. };
  5. module.exports.handle = handle;
  6. </wxs>
  7. <view class="calendar">
  8. <view class="header">
  9. <view class="date">
  10. <picker
  11. mode="date"
  12. fields="month"
  13. value="{{pickDate}}"
  14. bindchange="bindPickDateChange"
  15. >
  16. <text class="date-display">{{pickDateDisplay}}</text>
  17. </picker>
  18. <view class="controller">
  19. <view class="control-item" bindtap="control" data-mode="pre">
  20. <image src="https://images.vrm.cn/2019/08/29/left-arrow.png" class="icon"></image>
  21. </view>
  22. <view class="control-item" bindtap="control" data-mode="reset">
  23. <image src="https://images.vrm.cn/2019/08/29/rotate.png" class="icon"></image>
  24. </view>
  25. <view class="control-item" bindtap="control" data-mode="next">
  26. <image src="https://images.vrm.cn/2019/08/29/right-arrow.png" class="icon"></image>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="divide"></view>
  31. </view>
  32. <view class="days">
  33. <view class="dateType">
  34. <view class="day">一</view>
  35. <view class="day">二</view>
  36. <view class="day">三</view>
  37. <view class="day">四</view>
  38. <view class="day">五</view>
  39. <view class="day weeken">六</view>
  40. <view class="day weeken">日</view>
  41. </view>
  42. <view class="dateType">
  43. <view
  44. class="day {{item.position}} {{item.week === 6 || item.week === 7 ? 'weeken' : ''}} {{selectedDate === item.date ? 'selected-date' : ''}} {{today === item.date && showToday ? 'today' : ''}} {{item.inRange ? 'inrange' : ''}} {{rangeStyle.handle(item, dateRange)}}"
  45. wx:for="{{allDays}}"
  46. wx:key="index"
  47. bindtap="onPickDay"
  48. data-day="{{item}}"
  49. >
  50. {{item.dateNumber}}
  51. </view>
  52. </view>
  53. </view>
  54. </view>