element-ui日期选择器

<el-date-picker
v-model="filters.dateValue"
type="daterange"
value-format="yyyy-MM-dd"
:default-time="['00:00:00', '23:59:59']"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>

filters: {
dateValue: ["", ""],
dateValue: ["", ""],
},

//因为选择时间,然后删除时间后再次搜索,会直接报错。后发现容错如下:
beginDate:
this.filters.dateValue != null
? this.filters.dateValue[0]
: this.filters.dateValue,
endDate:
this.filters.dateValue != null
? this.filters.dateValue[1]
: this.filters.dateValue,






------------------------------------------------时间回显------------------------------------------------

this.filters= Object.assign({}, val);
this.filters.dateValue = [];
this.filters.dateValue.push(val.startTime) 
this.filters.dateValue.push(val.endTime)



posted @ 2020-01-12 16:55  云霄紫潭  阅读(841)  评论(0编辑  收藏  举报