fix: 补上 dashboard 缺失的 formatBytes 函数定义

This commit is contained in:
sun
2026-08-16 18:41:33 +08:00
parent ec2b78533d
commit 0f7102a41d
+7
View File
@@ -642,6 +642,13 @@
return `${m}m`; return `${m}m`;
}; };
const formatBytes = (b) => {
if (!b) return "0 B";
const k = 1024, sizes = ["B", "KB", "MB", "GB"];
const i = Math.floor(Math.log(b) / Math.log(k));
return (b / Math.pow(k, i)).toFixed(1) + " " + sizes[i];
};
onMounted(() => { onMounted(() => {
refresh(); refresh();
setInterval(refresh, 10000); setInterval(refresh, 10000);