var datetime = new Date();
var year=datetime.getFullYear();//获取完整的年份(4位,如:1970)
var month=datetime.getMonth()+1;//获取月份(返回0-11,0代表1月,用的时候记得加上1)
var date=datetime.getDate();//获取日(返回1-31)
//判断小于等于9月的时候在月份前加一个"0"
if(month<=9){
month="0"+month;
}
//判断小于等于9号的时候在天数前加一个"0"
if(date<=9){
date="0"+date;
}
this.dateToday=year+"-"+month+"-"+date;
},
09-19
3606
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-08
831
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-28
4万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)