this.$http.get('api/info').then(res => {
this.setUserInfo(res);
this.level = res.level
var endTime = res.membershipExpire //'2023-04-19T03:59:17.000+0000'
this.vipdate = endTime.split("T")[0]//截至日期分割,只显示日期'2023-04-19'
var timestamp = Date.parse(new Date()); //得到现在的时间戳
var end = new Date(endTime) //转换为Date类型
var end_time = end.getTime()//截止日期的时间戳
console.log('ll',timestamp)
if(end_time>timestamp){//进行对比
this.level = 1
}else{
this.level = 0
}
});
截取日期,并和现在的时间对比
于 2022-04-27 15:36:20 首次发布