//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
}
}
},
}
}
}
结果:
这样就好了,喜欢就关注我把谢谢。