formatDateTime: function (inputTime) {
let date = new Date(inputTime)
let year = date.getFullYear()
let month = date.getMonth() + 1
month = month < 10 ? ('0' + month) : month
let datetime = date.getDate()
datetime = datetime < 10 ? ('0' + datetime) : datetime
let hour = date.getHours()
hour = hour < 10 ? ('0' + hour) : hour
let minute = date.getMinutes()
let second = date.getSeconds()
minute = minute < 10 ? ('0' + minute) : minute
second = second < 10 ? ('0' + second) : second
// 昨天
let day1 = new Date()
day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000)
let day1month = day1.getMonth() + 1
day1month = day1month < 10 ? ('0' + day1month) : day1month
let day1datetime = day1.getDate()
day1datetime = day1datetime < 10 ? ('0' + day1datetime) : day1datetime
let s1 = day1.getFullYear() + '-' + day1month + '-' + day1datetime
// 今天
let day2 = new Date()
day2.setTime(day2.getTime())
let day2month = day2.getMonth() + 1
day2month = day2month < 10 ? ('0' + day2month) : day2month
let day2datetime = day2.getDate()
day2datetime = day2datetime < 10 ? ('0' + day2datetime) : day2datetime
let s2 = day2.getFullYear() + '-' + day2month + '-' + day2datetime
if (s1 === (year + '-' + month + '-' + datetime)) {
return '昨天 ' + hour + ':' + minute + ':' + second
} else if (s2 === (year + '-' + month + '-' + datetime)) {
return '今天 ' + hour + ':' + minute + ':' + second
} else {
return year + '-' + month + '-' + datetime + ' ' + hour + ':' + minute + ':' + second
}
},