从后端数据拿回来的是时间戳格式,需要将其格式化成日期形式
后端数据: expiry:1656345599
前端展示:有效期:2022-06-27 23:59:59
1、安装date-fns
npm i date-fns
2、在需要的组件中引入其方法
import { format } from "date-fns";
<v-row class="align-center">
<v-col cols="3">
<v-subheader style="color: rgba(0, 0, 0, 0.7)"> 有效期</v-subheader>
</v-col>
<v-col cols="9">
{{ format(expiry * 1000, "yyyy-MM-dd HH:mm:ss") }}
</v-col>
</v-row>
data(){
return {
format,
expiry:1656345599
}
}