new UI and handle cashing
This commit is contained in:
@@ -24,6 +24,14 @@ export function useTowDecimal(num: string | number): string | number {
|
||||
return formatGroupedPrice(Math.round(+num * 100) / 100, false)
|
||||
}
|
||||
|
||||
export function formatSignedPercentChange(value: number): string {
|
||||
if (!value) return '0%'
|
||||
|
||||
const formatted = useTowDecimal(Math.abs(value))
|
||||
const prefix = value > 0 ? '+' : '-'
|
||||
return `${prefix}${formatted}%`
|
||||
}
|
||||
|
||||
export function useFormat(num: string | number, unit = '') {
|
||||
return usePrice(Math.abs(+useTowDecimal(num)), true, unit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user