Element date-picker

2020-12-13  本文已影响0人  高磊_IT
let startTime: any;
let endTime: any;
//定义在export外面
export default class PrintAccount extends Vue {
<el-date-picker v-model="chooseDate" type="daterange" :picker-options="pickerOptions" start-placeholder="开始日期" range-separator="至" end-placeholder="结束日期">
              </el-date-picker>
  async getTimeRange() {
    let resvMainNo: string = "";
    let scope: string = "";
    if (this.billItemList) {
      resvMainNo = this.billItemList.resvMainNo;
      scope = "RESV_MAIN";
    }
    const timeRange = await queryDataRange(resvMainNo, scope);
    startTime = new Date(timeRange.minDate).getTime();
    endTime = new Date(timeRange.maxDate).getTime();
    console.log(startTime, endTime);
  }

  // 時間選擇
  private pickerOptions = {
    disabledDate(time: any) {
      console.log(startTime, endTime);
      return time.getTime() > endTime  || time.getTime() < startTime - 8.64e7;
    },
  };
上一篇下一篇

猜你喜欢

热点阅读