<el-form-item>
        <el-date-picker type="date" format="yyyy-MM-dd" clearable value-format="yyyy-MM-dd"
            v-model="formItem.startDate" size="small" placeholder="开始日期" :picker-options="pickerOptionsStart">
        </el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-date-picker type="date" format="yyyy-MM-dd" clearable value-format="yyyy-MM-dd"
            v-model="formItem.endDate" size="small" placeholder="结束日期" :picker-options="pickerOptionsEnd">
        </el-date-picker>
</el-form-item>

formItem: {
        startDate: '',
        endDate: ''
}

pickerOptionsStart: {
        disabledDate: time => {
          const endDateVal = new Date(this.formItem.endDate).getTime()
          if (endDateVal) {
            return time.getTime() > endDateVal - 0
          }
        }
},
pickerOptionsEnd: {
        disabledDate: time => {
          const beginDateVal = new Date(this.formItem.startDate).getTime()
          if (beginDateVal) {
            return time.getTime() < beginDateVal - 0
          }
        }
}

 

Logo

前往低代码交流专区

更多推荐