layui 统计行totalRow 保留两位小数

done(data,curr, count){
                var tableView = this.elem.next();               
                var totalRow = tableView.find('.layui-table-total');
                layui.each(totalRow.find('td'), function (index, tdElem) {
                    tdElem = $(tdElem);
                    var text = tdElem.text();
                    if (text && !isNaN(text)) {
                        text = parseFloat(text).toFixed(2); //此处为小数点后个数
                        tdElem.find('div.layui-table-cell').html(text);
                    }
                });
            }

  

posted @ 2020-10-16 09:23  TOPHP  阅读(4130)  评论(5编辑  收藏  举报