Vue中时间的设置

设置默认属性
ct_month: null


方法:

//默认显示今天
getdatatime(){
this.ct_month= new Date();

},

//默认显示昨天
getdatatime(){
this.ct_month= new Date();
this.ct_month.setTime(this.ct_month.getTime() - 3600 * 1000 * 24);
},

//默认显示上周
getdatatime(){
this.ct_month= new Date();
this.ct_month.setTime(this.ct_month.getTime() - 3600 * 1000 * 24 * 7);
},


//默认显示上个月
getdatatime(){
this.ct_month= new Date();
this.ct_month.setTime(this.ct_month.getTime() - 3600 * 1000 * 24 * 30);
},

原文地址:https://www.cnblogs.com/ahao214/p/11235804.html