extjs 如何控制数字精度(小数位数)

2025-05-14 15:48:50
推荐回答(3个)
回答1:

var numFormated = Ext.util.Format(num,'0.00');//'0,00'为format定义

examples (123456.789):
0 - (123456) show only digits, no precision
0.00 - (123456.78) show only digits, 2 precision
0.0000 - (123456.7890) show only digits, 4 precision
0,000 - (123,456) show comma and digits, no precision
0,000.00 - (123,456.78) show comma and digits, 2 precision
0,0.00 - (123,456.78) shortcut method, show comma and digits, 2 precision
To reverse the grouping (,) and decimal (.) for international numbers, add /i to the end. For example: 0.000,00/i

回答2:

var numFormated = Ext.util.Format.number(num,'0.00');
这样才对,要用Format下的number方法,被忽悠的浪费好长时间

回答3:

一楼正解