用JS获取当前时间和之后几天的时间
handleTime(day) {
console.log(new Date(new Date().setDate(new Date().getDate() + Number(day))).toJSON())
return new Date(new Date().setDate(new Date().getDate() + Number(day))).toJSON().split('T')[0]
},
![打印的结果](https://img-blog.csdnimg.cn/20190529165441725.png)
new Date(new Date().setMonth(new Date().getMonth() - 1)).toJSON().split('T')[0] // 获取前一个月的时间
export const GET_NOW_TIME = new Date().toJSON().split('T')[0] // 获取当前时间