Calendar.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div>
  3. <u-calendar
  4. :show="true"
  5. :mode="mode"
  6. @confirm="confirm"
  7. @close="closeCalendar"
  8. ></u-calendar>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. mode: "range",
  16. timeList: [], //选择的时间
  17. };
  18. },
  19. onLoad(options){
  20. if(options.mode){
  21. this.mode = options.mode;
  22. }
  23. },
  24. mounted() {
  25. this.initDate();
  26. },
  27. methods: {
  28. confirm(e) {
  29. console.log(e);
  30. this.$store.commit("setTimeList", e);
  31. uni.navigateBack();
  32. // this.timeList = e;
  33. },
  34. closeCalendar() {
  35. this.calendarShow = false;
  36. },
  37. //初始化时间
  38. initDate() {
  39. let date = new Date();
  40. let year = date.getFullYear();
  41. let month = date.getMonth() + 1;
  42. let day = date.getDate();
  43. let time = year + "-" + month + "-" + day;
  44. this.timeList = [time, time];
  45. },
  46. },
  47. };
  48. </script>
  49. <style lang="scss" scoped>
  50. /deep/.u-popup__content{
  51. height: 100vh;
  52. flex: none !important;
  53. scroll-view{
  54. height: 70vh !important;
  55. }
  56. }
  57. /deep/.u-icon__icon{
  58. display: none !important;
  59. }
  60. </style>