繁体   English   中英

Flex mx:CurrencyFormatter格式不正确

[英]Flex mx:CurrencyFormatter is not formatting correctly

当我使用以下格式化程序时,我得到了错误的值。

<mx:CurrencyFormatter
        id="currencyFormatter"
        currencySymbol=""
        precision="2"
        rounding="up"
        decimalSeparatorFrom=","
        decimalSeparatorTo=","
        useNegativeSign="true"
        useThousandsSeparator="true"
        thousandsSeparatorFrom="."
        thousandsSeparatorTo="."
        alignSymbol="left" />

例如,如果我传递值1.5,那么格式化方法的结果就是“ 15,00”。 有人知道这里发生了什么吗? ks

我发现了问题:在我的代码中,我试图这样做:

currencyFormatter.format(item.total.toString())

我决定删除toString方法,如下所示:

currencyFormatter.format(item.total)

如果我将值“ 1.5”作为字符串传递给格式化程序,则结果为“ 15,00”。 但是,如果我将值“ 1.5”作为数字传递,则会得到正确的格式(“ 1,50”)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM