// 设置时间过滤
Vue.filter('dateFormat', function (originVal) {
const dt = new Date(originVal * 1000)
const y = dt.getFullYear()
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
const d = (dt.getDate() + '').padStart(2, '0')
const hh = (dt.getHours() + '').padStart(2, '0')
const mm = (dt.getMinutes() + '').padStart(2, '0')
const ss = (dt.getSeconds() + '').padStart(2, '0')
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
vue中时间过滤器
最新推荐文章于 2023-08-08 16:57:28 发布