Merge pull request #576 from bourne7/master

table 的合计行现在可以指定保留的小数点位了。如果不指定的话就是默认的 2 位,可以通过参数 totalRowDecimalScale 来指定。
This commit is contained in:
贤心
2022-06-20 16:55:44 +08:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@@ -991,8 +991,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
//td 内容
var content = function(){
if( item3.totalRowDecimalScale == null || isNaN(item3.totalRowDecimalScale) ||
item3.totalRowDecimalScale < 0 || item3.totalRowDecimalScale > 10 ){
// 如果检测到非法值就重设为2。至于非法值的定义这里是我自己定义的。
item3.totalRowDecimalScale = 2;
}
var text = item3.totalRowText || ''
,thisTotalNum = parseFloat(totalNums[field]).toFixed(2)
,thisTotalNum = parseFloat(totalNums[field]).toFixed(item3.totalRowDecimalScale)
,tplData = {}
,getContent;