<el-date-picker
:picker-options='pickerStartOptions(search.endReleaseTime)'
v-model="search.startReleaseTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择开始日期">
</el-date-picker>
<el-date-picker
:picker-options='pickerEndOptions(search.startReleaseTime)'
v-model="search.endReleaseTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择结束日期">
</el-date-picker>
export default {
data(){
return{
pickerStartOptions(endTime){
return {
disabledDate(time){
if(endTime){
// 拼接 00:00:00 是为了统一日期从0点开始
return time.getTime() > new Date(endTime +' 00:00:00').getTime();
}
}
}
},
pickerEndOptions(startTime){
return {
disabledDate(time){
if(startTime){
// 拼接 00:00:00 是为了统一日期从0点开始
return time.getTime() < new Date(startTime +' 00:00:00').getTime();
}
}
}
}
}
}
}