const costClass = baseListvaluereduceresult item = const key = $itemcostClassId-$itemcostClass; if !resultkey resultkey = costMoney 0 costCredit 0 cfTota
The error occurs because there is a typo in the code. In the for...in loop, the variable costClass is already defined as a parameter of the loop, and it is being used as a variable name within the loop as well. This causes a conflict and results in costClass being undefined.
To fix the error, you can change the variable name in the loop to something different, such as costClassObj, like this:
for (const key in costClass) {
const [costClassId, costClassName] = key.split('-');
const { costMoney, costCredit, cfTotal, costRefund, cfSurplus, ids } = costClass[key];
costClassList.value.push({
costClassId,
costClassName,
costMoney,
costCredit,
cfTotal,
costRefund,
cfSurplus,
ids,
});
}
This way, the variable costClass within the loop will refer to the individual objects in the costClass object, and the error should be resolved.
原文地址: https://www.cveoy.top/t/topic/i4N8 著作权归作者所有。请勿转载和采集!