2
格式在JavaScript中执行货币的基于地区的格式,你货币Clojurescript
(550.753).toLocaleString(undefined, {style: 'currency', currency: 'USD'})
// # $550.75 in en-US
你怎么做相同的Clojurescript?
我已经试过
(.toLocaleString 550.753 nil {:style "currency" :currency "USD"})
无济于事。
谢谢你的回答。我想知道是否有一种方法可以为语言环境提供未定义的值。在我写的其他JS(针对Firefox)中,旨在作为区域设置不可知的,指定未定义的区域意味着使用浏览器区域设置。这在Clojurescript中可能吗? – wegry
'(.toLocaleString 550.753 js/undefined #js {:style“currency”:currency“USD”})'是我正在寻找的东西。 – wegry
查看https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument,如果您想使用默认语言环境,那么最好传递'[]' 。 –