MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / yUnitFormatter

Function yUnitFormatter

frontend/packages/dashboard/src/utils/dashboard.ts:79–91  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

77}
78
79export function yUnitFormatter(value: number): string {
80 let res: string = ''
81 if (value > 100000000) {
82 res = (value / 100000000).toFixed(2) + $t('亿')
83 } else if (value > 1000000) {
84 res = (value / 10000).toFixed(0) + $t('万')
85 } else if (value > 100000) {
86 res = (value / 10000).toFixed(2) + $t('万')
87 } else {
88 res = value.toFixed(0)
89 }
90 return res
91}
92
93/**
94 * 格式化数字并添加适当的单位后缀

Calls 1

$tFunction · 0.90

Tested by

no test coverage detected