perf: detection左侧筛选样式微调

This commit is contained in:
chenjinsong
2022-02-28 15:24:47 +08:00
parent e812a2db2a
commit 2bd18a18ea
2 changed files with 5 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import { unitTypes } from '@/utils/constants'
import _ from 'lodash'
const numberUnit = ['', 'K', 'M', 'G', 'T', 'P', 'E']
const byteUnit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']
@@ -35,6 +36,9 @@ export function byteUnitConvert (value, sourceUnit = 'B', targetUnit, dot = 2) {
}
/* 时间单位转换例如将ms转为h */
export function timeUnitFormatter (time, sourceUnit = 'ms', targetUnit, dot = 2) {
if (!_.isNumber(time) || time === 0) {
return [0, sourceUnit]
}
let sourceIndex = -1
let targetIndex = -1
timeUnit.forEach((t, i) => {