<template>
  <div>
    <u-calendar
      :show="true"
      :mode="mode"
      @confirm="confirm"
      @close="closeCalendar"
    ></u-calendar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      mode: "range",
      timeList: [], //选择的时间
    };
  },
  onLoad(options){
    if(options.mode){
      this.mode = options.mode;
    }
  },
  mounted() {
    this.initDate();
  },
  methods: {
    confirm(e) {
      console.log(e);
      this.$store.commit("setTimeList", e);
      uni.navigateBack();
      // this.timeList = e;
    },
    closeCalendar() {
      this.calendarShow = false;
    },
    //初始化时间
    initDate() {
      let date = new Date();
      let year = date.getFullYear();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      let time = year + "-" + month + "-" + day;
      this.timeList = [time, time];
    },
  },
};
</script>

<style lang="scss" scoped>
/deep/.u-popup__content{
  height: 100vh;
  flex: none !important;
  scroll-view{
    height: 70vh !important;
  }
}
/deep/.u-icon__icon{
  display: none !important;
}

</style>
