<template>
<div class="block">
<el-date-picker v-model="timeRange" type="datetimerange" align="right" value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm" size="small" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
@change="change" :picker-options="pickerOptions" clearable>
</el-date-picker>
</div>
</template>
<script>
export default {
data() {
return {
TimeRange: ["", ""],
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now(); //选择时间要小于今天和今天只后
},
},
queryForm: {
startDate: "", //开始时间
endDate: "", //结束时间
},
};
},
methods: {
change() {
if (!this.timeRange) {
this.queryForm.startDate = "";
this.queryForm.endDate = "";
} else {
this.queryForm.startDate = this.timeRange[0];
this.queryForm.endDate = this.timeRange[0];
}
this.接口();
},
},
};
</script>
vue element DateTimePicker 日期时间选择器
最新推荐文章于 2024-04-19 09:51:41 发布