Element 選擇日期組件開始時間小於結束時間


DEMO:

<template>
   <div class="app-container">
      <el-date-picker v-model="filters.column.create_start_date" type="date" :picker-options="pickerBeginDateBefore" format="yyyy-MM-dd" placeholder="開始日期">
      </el-date-picker>
      <el-date-picker v-model="filters.column.create_end_date" type="date" format="yyyy-MM-dd" :picker-options="pickerBeginDateAfter" placeholder="結束日期">
      </el-date-picker>
   </div>
</template>
<script>
export  default {
    data() {
       return  {
          filters: {
             column: {
                create_start_date:  '' ,
                create_end_date:  ''
             },
          },
          pickerBeginDateBefore: {
             disabledDate: (time) => {
                let  beginDateVal = this.filters.column.create_end_date;
                if  (beginDateVal) {
                   return  time.getTime() > beginDateVal;
                }
             }
          },
          pickerBeginDateAfter: {
             disabledDate: (time) => {
                let  beginDateVal = this.filters.column.create_start_date;
                if  (beginDateVal) {
                   return  time.getTime() < beginDateVal;
                }
             }
          }
 
       }
    }
}
</script>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM