element ui实现起始时间不能大于结束时间

<template>
   <div class="app-container">
       <el-date-picker  v-model="formItem.palnStartTime" type="datetime" placeholder="选择日期" size="small"  value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerBeginDateBefore"  @change="changeTime">
      </el-date-picker>
      <el-date-picker  v-model="formItem.planEndTime"  type="datetime" placeholder="选择日期" size="small" value-format="yyyy-MM-dd HH:mm:ss" :pickeroptions="pickerBeginDateAfter">
      </el-date-picker>
   </div>
</template>
   data() {
      return {
         filters: {
            column: {
               create_start_date: '',
               create_end_date: ''
            },
         },
         pickerBeginDateBefore: {
            disabledDate: (time) => {
               let beginDateVal = this.formItem.planEndTime;
               if (beginDateVal) {
                  return time.getTime() > beginDateVal;
               }
            }
         },
         pickerBeginDateAfter: {
            disabledDate: (time) => {
               let beginDateVal =this.formItem.palnStartTime;
               if (beginDateVal) {
                  return time.getTime() < beginDateVal;
               }
            }
         }

      }
   }
      //选择开始时间,清空结束时间
      changeTime(date){
            this.formItem.planEndTime="";
            this.pickerBeginDateAfter={
              disabledDate(time) {  //开始时间-结束时间   
                return (time.getTime() < new Date(date).getTime());
              }
            }
      },
GitHub 加速计划 / eleme / element
10
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:4 个月前 )
c345bb45 8 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 8 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐