formatbytes (bytes) {
if (bytes === 0) return ‘0 B’
const k = 1024
const sizes = [‘B’, ‘KB’, ‘MB’, ‘GB’, ‘TB’, ‘PB’, ‘EB’, ‘ZB’, ‘YB’]
const i = Math.floor(Math.log(bytes) / Math.log(k))
return (bytes / Math.pow(k, i)).toPrecision(3) + ’ ’ + sizes[i]
},
vue 文件大小单位换算
最新推荐文章于 2023-04-06 17:36:43 发布