时间搜索 vue2+antd
<a-form-item label="订单开始时间:"><a-range-picker v-model="date" valueFormat="YYYY-MM-DD" @change="onChange" /></a-form-item>
onChange (date) {if (date.length > 0) {this.queryParam.startTime = date[0];this.queryParam.endTime = date[1];} else {this.queryParam.startTime = "";this.queryParam.endTime = "";}},
getData () {this.loading = true;this.queryParam.date = null;classifyCount(Object.assign({current: this.pagination.current,size: this.pagination.pageSize},this.queryParam)).then(res => {this.loading = false;if (res.data.code == 0) {const { records, current, size, total } = res?.data?.data ?? {};this.dataList = records;this.pagination.current = current;this.pagination.pageSize = size;this.pagination.total = total;}});},
---------------------------------------------------------------------------------------------------------------------------------
2.时间搜索+vue2+element+dayjs
<el-date-pickerv-model="queryParams.date"type="daterange"range-separator="至"start-placeholder="开始日期"end-placeholder="结束日期"></el-date-picker>import dayjs from "dayjs";getList() {// this.getTime();let mData = Object.assign({pageNum: this.pagination.current,pageSize: this.pagination.pageSize,},// this.queryParams{...this.queryParams,startTime: this.queryParams?.date?.length? dayjs(this.queryParams.date[0]).format("YYYY-MM-DD"): undefined,endTime:this.queryParams?.date?.length > 1? dayjs(this.queryParams.date[1]).format("YYYY-MM-DD"): undefined,});mData.createUserId = store.getters.userId;this.loading = true;listDemo(mData).then((res) => {if (res.code == 200) {console.log("res", res);this.remindersList = res.rows;console.log("this.remindersList", this.remindersList);this.pagination.total = res.total;this.loading = false;}}).finally(() => {this.loading = false;})