<el-date-picker
              v-model="searchForm.dutyYear"
              align="right"
              type="year"
              value-format="yyyy"
              placeholder="年份"
              @change="changeValue">
</el-date-picker>
searchForm: {
        dutyYear: '',
        makeCompany: ''
},
created() {
 this.searchForm.dutyYear = new Date().getFullYear()+'';
}


    

Element 报错 dateStr.match is not a function“ 这个错误是因为Element
的日期组件的数据类型不能为Number

  /**
     * 查询当天日期
     */
    getNowDate() {
      const timeOne = new Date()
      const year = timeOne.getFullYear()
      let month = timeOne.getMonth() + 1
      let day = timeOne.getDate()
      month = month < 10 ? '0' + month : month
      day = day < 10 ? '0' + day : day
      const NOW_MONTHS_AGO = `${year}-${month}-${day}`
      return NOW_MONTHS_AGO
    }

Logo

前往低代码交流专区

更多推荐