zoukankan      html  css  js  c++  java
  • 【ElementUI】DatePicker 日期选择器 设置日期,只能选择今天和未来时间

    最近的 工作当中遇到一个问题,就是使用Element日期控件 DatePicker 日期选择器的时候,因为我是用于预约功能 产品说:过去的时间还能选,是想让他穿越嘛…(能穿越多好!起)哈哈哈哈

    本来是这样的


    在DatePicker 日期选择器组件上设置:picker-options=“pickerOptions”

     1     <el-row :gutter="1">
     2             <el-col :span="13">
     3               <el-date-picker
     4                 v-model="Dateshijian"
     5                 type="date"
     6                 value-format="yyyy-MM-dd"
     7                 @change="getlist"
     8                 :picker-options="pickerOptions"//就是这个
     9                 placeholder="选择活动日期"
    10               ></el-date-picker>
    11             </el-col>
    12             <el-col :span="11" class="hone">
    13               <el-input
    14                 placeholder="请输入标题"
    15                 clearable
    16                 @clear="getlist"
    17                 v-model="data.title"
    18                 class="Gallery_sous"
    19               >
    20                 <el-button
    21                   slot="append"
    22                   :loading="loadings"
    23                   icon="el-icon-search"
    24                   @click="getlist()"
    25                 ></el-button>
    26               </el-input>
    27             </el-col>
    28           </el-row>


    在data中设置下

      data() {
        return {
          pickerOptions: {
            // 限制预约时间
            disabledDate(time) {
              return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
            }
          },
         
      },


    设置后


    放上去会有禁止号 截图不下来
    完事!
    原文链接:https://blog.csdn.net/v5666666/article/details/107160988

  • 相关阅读:
    qiankun 报错:Target container with #container not existed while xxx mounting!
    promise加载队列实现
    promise 封装定时器
    关于promise
    节流防抖
    箭头函数特点
    this
    手写apply
    手写call
    手写bind函数
  • 原文地址:https://www.cnblogs.com/haoqi1997/p/13255331.html
Copyright © 2011-2022 走看看