Skip to content

Commit 11d4e2e

Browse files
committed
补全 fileSizeFormatter 的注释
1 parent 07d79e3 commit 11d4e2e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/utils/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,18 @@ export const generateUUID = () => {
138138
})
139139
}
140140

141-
export const fileSizeFormatter = (row) => {
141+
/**
142+
* element plus 的文件大小 Formatter 实现
143+
*
144+
* @param row 行数据
145+
* @param column 字段
146+
* @param cellValue 字段值
147+
*/
148+
// @ts-ignore
149+
export const fileSizeFormatter = (row, column, cellValue) => {
150+
const fileSize = cellValue
142151
const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
143-
const srcSize = parseFloat(row.size)
152+
const srcSize = parseFloat(fileSize)
144153
const index = Math.floor(Math.log(srcSize) / Math.log(1024))
145154
const size = srcSize / Math.pow(1024, index)
146155
const sizeStr = size.toFixed(2) //保留的小数位数

0 commit comments

Comments
 (0)