elementUI的日期选择框,两选择框关联时间限值

  • Post author:
  • Post category:其他


<el-date-picker
            style="width:48%"
                                      class="datepicker"
                                      size="mini"
                                      v-model="startTimed"
                                      type="date"
                                      value-format="yyyy-MM-dd"
                                      format="yyyy-MM-dd"
                                      :picker-options="start_date"
                                      placeholder="选择开始日期">
                                    </el-date-picker>
                                    <span style="display: inline-block; 40px;font-size: 12px;text-align: center;">~</span>
                                    <el-date-picker
                                    style="width:48%"
                                      class="datepicker"
                                      size="mini"
                                      v-model="endTimed"
                                      type="date"
                                      value-format="yyyy-MM-dd"
                                      format="yyyy-MM-dd"
                                      :picker-options="end_date"
                                      placeholder="选择结束日期">
                                    </el-date-picker>
 data() {
    return {
      startTimed:'',
      endTimed:'',
      end_date:{//结束时间范围限定
          disabledDate:time => {
            var month = ''
            var day = ''
            month = Number(time.getMonth())+1
            day = time.getDate()
            if(month<10){
              month = '0'+month
            }
            if(day <10){
              day = '0'+day
            }
            var tiems = ''
            tiems = time.getFullYear()+'-'+month+'-'+day
              return tiems < this.startTimed;
          }
      },
}
}



版权声明:本文为lw_1220原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。