// 定义全局过滤器,如果时间戳是10位就乘以1000,如果是13位就不乘
Vue.filter('filterTime',(oldTiem)=>{let date =newDate(parseInt(oldTiem)*1000);let nowTime =newDatelet nowDate = nowTime.getDate()let time ="上午"if(date.getHours()>12){
time ="下午"}if(nowDate > date.getDate()){return`${date.getMonth()+1}月 ${date.getDate()}日 ${time}${date.getHours()}:${date.getMinutes()}`}else{return`${time}${date.getHours()}:${date.getMinutes()}`}})
// 定义全局过滤器,将时间戳转换成 年-月-日 时:分:秒
Vue.filter('filterTime',(value)=>{const date =newDate(value)const y = date.getFullYear()const m =(date.getMonth()+1+'').padStart(2,'0')const d =(date.getDate()+'').padStart(2,'0')const h =(date.getHours()+'').padStart(2,'0')const min =(date.getMinutes()+'').padStart(2,'0')const ss =(date.getSeconds()+'').padStart(2,'0')return`${y}-${m}-${d}${h}:${min}:${ss}`})