直播平台制作,vue-全局过滤器(时间,年月日,一千加逗号处理)
export const formatYmd = (date) => {
let time = new Date(date)
let y = time.getFullYear()
let m = time.getMonth() + 1
let d = time.getDate()
return [y, m, d].map((v) => String(v).padStart(2, '0')).join('/')
}
//处理年月日时分秒
export const formatYmdHms = (date) => {
let time = new Date(date)
let y = time.getFullYear()
let M = time.getMonth() + 1
let d = time.getDate()
let h = time.getHours()
let m = time.getMinutes()
let s = time.getSeconds()
return (
[y, M, d].map((v) => String(v).padStart(2, '0')).join('-') +
' ' +
[h, m, s].map((v) => String(v).padStart(2, '0')).join(':')
)
}
//处理时分秒
export const formatHms = (date) => {
let time = new Date(date)
let h = time.getHours()
let m =
以上就是 直播平台制作,vue-全局过滤器(时间,年月日,一千加逗号处理),更多内容欢迎关注之后的文章
标签:vue,逗号,let,time,date,年月日 From: https://www.cnblogs.com/yunbaomengnan/p/17748955.html