element日期范围选择获取时间

<el-date-picker
      v-model="rangeDate"
      prefix-icon="el-icon-date"
      type="daterange"
      start-placeholder="开始日期"
      end-placeholder="结束日期"
      size="small"
      value-format="yyyy-MM-dd"
></el-date-picker>

获取开始日期和结束日期

data () {
    return {
      rangeDate: [] 
  } 
watch: {
    rangeDate: function (newVal, oldVal) {
      if (newVal !== null) {
        this.tableParams.beginDate = newVal[0]
        this.tableParams.endDate = newVal[1]
      } else {
        this.tableParams.beginDate = null
        this.tableParams.endDate = null
      }
    }
  }

猜你喜欢

转载自blog.csdn.net/LinBM123/article/details/90401405