标签:ext 14. web fan return margin 2.0 lin nan
###对数log 的妙用。。。
formatBytes(bytes) {
if (bytes === ‘0‘ || isNaN(bytes)) return ‘‘;
var s = [‘Bytes‘, ‘KB‘, ‘MB‘, ‘GB‘, ‘TB‘, ‘PB‘];
var e = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(e))).toFixed(1) + " " + s[e];
},
标签:ext 14. web fan return margin 2.0 lin nan
原文地址:https://www.cnblogs.com/softwarelanguagebs/p/10758723.html