element el-date-picker 设置结束时间不能小于开始时间

    //html
      <div class="my-self-input" style="width:28%;">
        <el-date-picker  class="my-select"  v-model="pagingParmas.createDateStart" type="date" value-format="yyyy-MM-dd" 
        placeholder="开始时间" :picker-options="pickerOptionsStart" :clearable="false"></el-date-picker> ~
        <el-date-picker  class="my-select"  v-model="pagingParmas.createDateEnd" type="date" value-format="yyyy-MM-dd" 
        placeholder="结束时间" :picker-options="pickerOptionsEnd" :clearable="false"></el-date-picker>
      </div>

//js
    export default {
        data() {
            return {
                pagingParmas: {
                    createDateStart:'',//开始时间
                    createDateEnd:'', //结束时间  
                  },
                  pickerOptionsStart: {
                     disabledDate: time => {
                            if (this.pagingParmas.createDateEnd) {
                                 return time.getTime() > new Date(this.pagingParmas.createDateEnd).getTime()
                           }
                                }
                         },
                  pickerOptionsEnd: {
                                  disabledDate: time => {
                                        if (this.pagingParmas.createDateStart) {
                                                return time.getTime() < new Date(this.pagingParmas.createDateStart).getTime() - 86400000
                                        }
                                   }
                         },
            }
        }
    }
.png

结果:


开始时间.png

结束时间.png

这样就好了,喜欢就关注我把谢谢。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 怎么才能证明, 我是爱你的呢? 给你最轻的亲吻, 甜过密果与奶昔。 给你最美的笑意, 盖了秋冬与厚雪。 给你我最笨...
    唐诗远阅读 420评论 5 11
  • 如何正确的了解this对象 —— this对象是在运行时基于函数的执行环境绑定的,在全局函数中,this 等于wi...
    花了谢了还会开阅读 164评论 0 8
  • 文|三生顽石 “事实上,我只是发现了生活中的一些真相,然后编了一个很引人入胜的故事,带领读者阅读和体会它。...
    星辰如洒揽凉风阅读 976评论 7 7
  • 如今的不婚主义越来越多了,大概是看多了不幸的婚姻吧?家暴,出轨,婆媳关系,丧偶式育儿,守寡式婚姻,都让大家谈婚...
    珈珞_b73b阅读 326评论 0 0