Vue.prototype.dateTimeWeekday = function(){ let time, date = new Date();
let y = date.getFullYear(), mon = date.getMonth()+1, d = date.getDate(), h = date.getHours(), min = date.getMinutes(), sec = date.getSeconds(), weekday = [];
mon = mon<10?(‘0’+mon):mon; d = d<10?(‘0’+d):d; h = h<10?(‘0’+h):h; min = min<10?(‘0’+min):min; sec = sec<10?(‘0’+sec):sec; weekday[0]=“星期日”; weekday[1]=“星期一”; weekday[2]=“星期二”; weekday[3]=“星期三”; weekday[4]=“星期四”; weekday[5]=“星期五”; weekday[6]=“星期六”;
let dateStr = y+’.’+mon+’.’+d+’ ‘; let timeStr = h+’:’+min+’:’+sec; let dayStr = weekday[date.getDay()];
let dateTimeWeekday = {}; dateTimeWeekday.dateStr = dateStr; dateTimeWeekday.timeStr = timeStr; dateTimeWeekday.dayStr = dayStr;
return dateTimeWeekday; }