zoukankan      html  css  js  c++  java
  • element ui DateTimePicker 日期时间选择器 只能选择当前以及之后的时间

     1 <el-date-picker
     2     v-model="nowTime"
     3     type="datetime"
     4     format="yyyy-MM-dd HH:mm:ss"
     5     value-format="yyyy-MM-dd HH:mm:ss"
     6     placeholder="选择日期时间"
     7     :picker-options="pickerOptions"
     8     @change="handle"
     9 >
    10 </el-date-picker> 
    1 return {
    2     nowTime: '',
    3     pickerOptions: {
    4         disabledDate(time) {
    5              return time.getTime() < Date.now(); // 选当前时间之后的时间
    6         }
    7     }
    8 }

    选择时间大于当前的系统时间,会重置为当前时间

    1 methods:{
    2     handle(){
    3         new Date().getTime() > new Date(this.nowTime).getTime() && (this.nowTime = new Date());
    4     },
    5 }    
  • 相关阅读:
    Spring MVC(一)
    Spring-IOC总结
    IT
    Spring基础
    Maven
    Ajax笔记
    数据库和SQL语言
    JDBC
    拦截器
    文件上传
  • 原文地址:https://www.cnblogs.com/Blogzlj/p/14943528.html
Copyright © 2011-2022 走看看