使用vue自定义指令来处理时间
timer.js
> import dayjs from 'dayjs'
> export const time = {
> inserted(el, binding,vnode) {
> el.innerHTML= dayjs(1643098004611).format("YYYY-MM-DD
> HH:mm:ss") } }
app.vue
import {
time
} from "./custom/handleTime.js"
directives: {
time
}
<h1 v-time>{{1643098004611}}</h1>