flat: 图片优化
This commit is contained in:
@@ -433,6 +433,12 @@ function parseQueryParams(url = window.location.href) {
|
||||
return params;
|
||||
}
|
||||
|
||||
function formatFileSize(bytes) {
|
||||
if (bytes < 1024) return bytes + ' B'
|
||||
else if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB'
|
||||
else if (bytes < 1024 * 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(2) + ' MB'
|
||||
else return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB'
|
||||
}
|
||||
export const $api = {
|
||||
msg,
|
||||
prePage,
|
||||
@@ -442,7 +448,8 @@ export const $api = {
|
||||
streamRequest,
|
||||
chatRequest,
|
||||
insertSortData,
|
||||
uploadFile
|
||||
uploadFile,
|
||||
formatFileSize
|
||||
}
|
||||
|
||||
export default {
|
||||
|
Reference in New Issue
Block a user