mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-10-31 18:28:44 +08:00 
			
		
		
		
	补全 fileSizeFormatter 的注释
This commit is contained in:
		| @@ -138,9 +138,18 @@ export const generateUUID = () => { | ||||
|   }) | ||||
| } | ||||
|  | ||||
| export const fileSizeFormatter = (row) => { | ||||
| /** | ||||
|  * element plus 的文件大小 Formatter 实现 | ||||
|  * | ||||
|  * @param row 行数据 | ||||
|  * @param column 字段 | ||||
|  * @param cellValue 字段值 | ||||
|  */ | ||||
| // @ts-ignore | ||||
| export const fileSizeFormatter = (row, column, cellValue) => { | ||||
|   const fileSize = cellValue | ||||
|   const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] | ||||
|   const srcSize = parseFloat(row.size) | ||||
|   const srcSize = parseFloat(fileSize) | ||||
|   const index = Math.floor(Math.log(srcSize) / Math.log(1024)) | ||||
|   const size = srcSize / Math.pow(1024, index) | ||||
|   const sizeStr = size.toFixed(2) //保留的小数位数 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV