- 网站内容展示:首页, 产品页, 解决方案, 联系信息等 - 网站跳转逻辑:通过Vue-Router实现路由跳转 - 后端通信: 通过Nuxt Strapi与后端Strapi服务进行通信
12 lines
379 B
TypeScript
12 lines
379 B
TypeScript
export function formatFileSize(sizeInKB: number): string {
|
|
if (sizeInKB < 1024) {
|
|
return `${sizeInKB.toFixed(2)} KB`;
|
|
} else {
|
|
const sizeInMB = sizeInKB / 1024;
|
|
return `${sizeInMB.toFixed(2)} MB`;
|
|
}
|
|
}
|
|
|
|
export function formatFileExtension(ext: string): string {
|
|
return ext.startsWith('.') ? ext.slice(1).toUpperCase() : ext.toUpperCase();
|
|
} |