<el-date-picker
v-model="filterParames.startTime"
type="datetime"
placeholder="选择开始时间"
:picker-options="pickerOptionsStart"
>
</el-date-picker>
</div>
<div class="bottom-item">
<div class="item-label">结束时间</div>
<el-date-picker
v-model="filterParames.endTime"
type="datetime"
placeholder="选择结束时间"
:picker-options="pickerOptionsEnd">
</el-date-picker>
data () {
return {
filterParames: {
keyWord: null, // 关键字
startTime: new Date(), // 开始时间
endTime: new Date(), // 结束时间
status: 1
},
pickerOptionsStart: {
disabledDate: time => {
if (this.filterParames.endTime) {
return time.getTime() > new Date(this.filterParames.endTime).getTime()
}
}
},
pickerOptionsEnd: {
disabledDate: time => {
if (this.filterParames.startTime) {
return time.getTime() < new Date(this.filterParames.startTime).getTime() - 24 * 60 * 60 * 1000
}
}
}
}
网友评论