修改价格的格式化方法
This commit is contained in:
parent
c5cefb2b10
commit
1f8d3943bd
@ -1,12 +1,9 @@
|
||||
import moment from "moment"
|
||||
import { ethers } from "ethers"
|
||||
|
||||
// 计算价格精度
|
||||
export const priceCalculated = (price) => {
|
||||
let priceNum = Number(price)/1e18
|
||||
if(isNaN(priceNum)){return priceNum}
|
||||
let str = ''+priceNum
|
||||
if(!/e/i.test(str)){return priceNum}
|
||||
return (priceNum).toFixed(18).replace(/\.?0+$/,"")
|
||||
return ethers.utils.formatUnits(price, 18)
|
||||
}
|
||||
|
||||
export const timeFormat = (value) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user