fix: 修复needTotal求和的时候不支持多维数组以及字符串求和问题

This commit is contained in:
Yexk 2020-11-13 21:48:27 +08:00
parent c82103d64d
commit 344ad1d1f6

View File

@ -95,7 +95,14 @@ export default {
return { return {
...item, ...item,
total: selectedRows.reduce((sum, val) => { total: selectedRows.reduce((sum, val) => {
return sum + val[item.dataIndex] let v
try{
v = val[item.index] ? val[item.index] : eval(`val.${item.dataIndex}`);
}catch(_){
v = val[item.index];
}
v = !isNaN(parseFloat(v)) ? parseFloat(v) : 0;
return sum + v
}, 0) }, 0)
} }
}) })