vue elementui 日期datetimerange

1.template中:

        <el-col :xs="24" :sm="24" :md="24" :lg="10" :xl="8">
            <div class="pub_input_content">
              <span class="pub_input_title pub_input_title_data">创建时间</span>
              <el-date-picker
                v-model="searchData.create_time"
                value-format="yyyy-MM-dd HH:mm:ss"
                class="pub_input_input pub_input_data"
                type="datetimerange"
                clearable
                @change="dateChangebirthday"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              />
            </div>
          </el-col>

2.data中:

    // 搜索内容
      searchData: {
        list_type: '1',
        create_time: '', // 日期
        date: ''
      },

3.methods中:

    dateChangebirthday (val) {
      this.searchData.create_time = val
    },

    //获取数据方法中:
    if (this.searchData.create_time !== '' || this.searchData.create_time !== null) {
        const timeData = `${this.searchData.create_time[0]} - ${this.searchData.create_time[1]}`
        this.searchData.date = timeData
      } else {
        this.searchData.date = ''
      }
      const data = {
        list_type: this.searchData.list_type,
        create_time: this.searchData.date,
        page: this.page.currentPage,
        per_page: this.page.pageSize
      }

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值