mirror of
https://github.com/iczer/vue-antd-admin
synced 2025-04-05 19:41:37 +08:00
fix: 修复needTotal求和的时候不支持多维数组以及字符串求和问题
This commit is contained in:
parent
c82103d64d
commit
344ad1d1f6
@ -95,7 +95,14 @@ export default {
|
||||
return {
|
||||
...item,
|
||||
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)
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user