Show total/free ram in about page (#924)

This commit is contained in:
Chenlei Hu
2024-09-22 17:40:40 +09:00
committed by GitHub
parent 39eeda8430
commit 9aa976fdf0
4 changed files with 29 additions and 8 deletions

View File

@@ -9,6 +9,7 @@
<script setup lang="ts">
import type { DeviceStats } from '@/types/apiTypes'
import { formatMemory } from '@/utils/formatUtil'
const props = defineProps<{
device: DeviceStats
@@ -29,11 +30,7 @@ const formatValue = (value: any, field: string) => {
field
)
) {
const mb = Math.round(value / (1024 * 1024))
if (mb >= 1024) {
return `${(mb / 1024).toFixed(2)} GB`
}
return `${mb} MB`
return formatMemory(value)
}
return value
}