美文网首页
获取选中一个时间范围

获取选中一个时间范围

作者: 流泪手心_521 | 来源:发表于2020-09-08 14:24 被阅读0次

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)
          });
      }

相关文章

网友评论

      本文标题:获取选中一个时间范围

      本文链接:https://www.haomeiwen.com/subject/zbndektx.html