var tempDate = new Date()
tempDate.setDate(tempDate.getDate() - 30) // 今天的前N天的日期,N自定义
var date1 = {
year: tempDate.getFullYear(),
month: tempDate.getMonth() + 1,
date: tempDate.getDate()
}
var newM1 = date1.month > 9 ? date1.month : '0' + date1.month
var newD1 = date1.date > 9 ? date1.date : '0' + date1.date
var lastDate = date1.year + newM1.toString() + newD1//注意newM1会是数字类型 导致年月为数字相加之和 所以在月份后进行字符串转换
this.$set(this.queryCondition, 'releaseDateFromStr', lastDate)
var newDate = new Date()//当前日期
var date2 = {
year: newDate.getFullYear(),
month: newDate.getMonth() + 1,
date: newDate.getDate()
}
var newM2 = date2.month > 9 ? date2.month : '0' + date2.month
var newD2 = date2.date > 9 ? date2.date : '0' + date2.date
var curDate = date2.year + newM2.toString() + newD2
console.log('curDate',curDate);
this.$set(this.queryCondition, 'releaseDateToStr', curDate)