1.结构
<el-date-picker
v-model="queryDate"
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right">
</el-date-picker>
2.data定义
contentForm: {
limit: 10,
pageNo: 1,
startDate: '',
endDate:'',
},
total: 0,
queryDate:[],//查询时间
3.掉接口的时候获取选中时间
getList() {
this.contentForm.startDate=this.queryDate ? this.queryDate[0] : "";//开始时间赋值
this.contentForm.endDate=this.queryDate ? this.queryDate[1] : "";//结束时间赋值
materialLibApi.getMaterialLibList(this.contentForm).then(res=>{
if(res.status===0){
console.log(res);
}
}) .catch((error) => {
console.log('/lib/listPage查询资料库管理', error)
});
}
网友评论