如何添加空格作为十进制数字分隔符?当前格式是 23456.00
但它必须是 23 456
我已经用 .00
删除了 toFixed
,但空格分隔符没有运气。
{{parseFloat(post.meta.price).toFixed(0)}}
也许我可以将代码中的语言环境格式更改为 fr-FR,因为这会增加空格?
最佳答案
Perhaps I can change the locale format in the code to fr-FR because that will add the space?
是的你可以!
price = 23456.00
disp = new Intl.NumberFormat('fr-FR').format(price)
console.log(disp)
引用:
Intl.NumberFormat
关于javascript - 数字格式的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56766325/