el-date-picker设置默认值

vue yekong 92℃

vue

      <el-date-picker
        v-model="value"
        type="daterange"
        @change="getdate"
        start-placeholder="开始日期"
        end-placeholder="结束日期">
      </el-date-picker>

js

    getdate2 () {
      this.value = []
      var vStartDate = new moment().add('month', 0).format('YYYY-MM') + '-01'
      var vEndM = moment(vStartDate).add('month', 1).add('days', -1)
      var vEndDate = moment(vEndM).format('YYYY-MM-DD')
      this.value.push(new Date(vStartDate))
      this.value.push(new Date(vEndDate))
    },
喜欢 (0)