Browse Source

feat: [计算工具] 体积相减

zhangteng
memorylkf 4 days ago
parent
commit
8e0043f44c
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      src/utils/calUnitTools.js

+ 7
- 0
src/utils/calUnitTools.js View File

@ -45,6 +45,13 @@ export function subTj(valueArr, unitArr) {
mixIndex = thisIndex < mixIndex ? thisIndex : mixIndex mixIndex = thisIndex < mixIndex ? thisIndex : mixIndex
} }
if (mixIndex === -1) {
return {
total: 0,
unit: 'mL'
}
}
let total = multiplyDecimals( let total = multiplyDecimals(
parseFloat(valueArr[0]), parseFloat(valueArr[0]),
Math.pow(1000, unit.indexOf(unitArr[0]) - mixIndex) Math.pow(1000, unit.indexOf(unitArr[0]) - mixIndex)

Loading…
Cancel
Save