fix: timeshow
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<script setup>
|
||||
import { mediaService } from "@/api/mediaService";
|
||||
import dayjs from 'dayjs';
|
||||
import timezone from 'dayjs/plugin/timezone';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { InputText } from "primevue";
|
||||
import Badge from "primevue/badge";
|
||||
import Button from "primevue/button";
|
||||
@@ -131,6 +134,15 @@ const formatFileSize = (bytes) => {
|
||||
// Convert back to number and format with commas
|
||||
return `${Number(size).toLocaleString("en-US")} ${sizes[i]}`;
|
||||
};
|
||||
|
||||
// Configure dayjs
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
// Add formatDate function
|
||||
const formatDate = (date) => {
|
||||
return dayjs.tz(date, 'Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -191,7 +203,14 @@ const formatFileSize = (bytes) => {
|
||||
</template>
|
||||
</Column>
|
||||
|
||||
<Column field="upload_time" header="上传时间"></Column>
|
||||
<Column field="upload_time" header="时间信息">
|
||||
<template #body="{ data }">
|
||||
<div class="flex flex-col">
|
||||
<span class="text-gray-500">更新: {{ formatDate(data.updated_at) }}</span>
|
||||
<span class="text-gray-400">上传: {{ formatDate(data.created_at) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</Column>
|
||||
|
||||
<Column field="file_size" header="文件大小">
|
||||
<template #body="{ data }">
|
||||
|
||||
Reference in New Issue
Block a user