element ui 时间选择器 开始时间 结束时间 限制 结束时间不能小于开始时间
<div>
<label for="sel1" class="inp">开始时间(UT):</label>
<el-date-picker
:editable="false"
v-model="startBudgetTime"
:picker-options="startDatePicker"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始日期"
/>
</div>
<div>
<label for="sel1" class="inp">结束时间(UT):</label>
<el-date-picker
:editable="false"
v-model="endBudgetTime"
:picker-options="endDatePicker"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
default-time="['23:59:59']"
placeholder="选择结束日期"
/>
</div>
export default {
name: "SpacePosition",
data() {
return {
startBudgetTime: "",
endBudgetTime: "",
startDatePicker: this.beginDate(),
endDatePicker: this.processDate(),
};
},
}
methods: {
beginDate() {
const self = this;
return {
disabledDate(time) {
if (self.endBudgetTime) {
return new Date(self.endBudgetTime).getTime() < time.getTime();
} else {
}
}
};
},
processDate() {
const self = this;
return {
disabledDate(time) {
if (self.startBudgetTime) {
return new Date(self.startBudgetTime).getTime() > time.getTime();
} else {
}
}
};
},
}