fix: 补上 dashboard 缺失的 formatBytes 函数定义
This commit is contained in:
@@ -642,6 +642,13 @@
|
||||
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(() => {
|
||||
refresh();
|
||||
setInterval(refresh, 10000);
|
||||
|
||||
Reference in New Issue
Block a user