zoukankan      html  css  js  c++  java
  • el-date-picker限制联动日期为同一天内

    element ui 的el-date-picker,限定开始和结束时间为同一天内,且开始时间限定为当前时间之前

    1 <el-date-picker
    2       v-model="ip_session.parameter.date"
    3       type="datetimerange"
    4       :picker-options="pickerOptions1"
    5       range-separator="至"
    6       start-placeholder="开始日期"
    7       end-placeholder="结束日期"
    8       @change="selectData"
    9 />
     1 pickerOptions1: {
     2         startDate: null,
     3         disabledDate: time => {
     4           if (this.pickerOptions1.startDate === undefined || this.pickerOptions1.startDate === null) {
     5             return time.getTime() > Date.now()
     6           } else {
     7             return time.getTime() > this.pickerOptions1.startDate.getTime() + 86399000 || time.getTime() < this.pickerOptions1.startDate.getTime()
     8           }
     9         },
    10         onPick: dateRange => {
    11           this.pickerOptions1.startDate = dateRange.minDate
    12           if (dateRange.maxDate) {
    13             this.pickerOptions1.startDate = null
    14           }
    15         }
    16  }
    1 selectData(e) {
    2       if (e === null) {
    3         this.pickerOptions1.startDate = null
    4       }
    5 }

     效果:

     

  • 相关阅读:
    InnoDB in Mysql
    Store engine for Mysql
    Replication in Mysql
    Mysql note 3
    查看SQL对象的创建脚本
    Mysql note 2
    Jsp登录后数据采集奇怪的Apache服务器
    一行代码收集页
    使用Subsonic与ObjectDataSource(ODS)
    二分查找
  • 原文地址:https://www.cnblogs.com/dowi/p/12504600.html
Copyright © 2011-2022 走看看