我正在测试,我正在运行我的代码,无法弄清楚为什么我在测试平台上遇到错误
const displayCartTotal =({results}) => {
const [data] = results;
const {itemsInCart:itemsInDataCart, buyerCountry: buyerCountryData} =
data;
appState.items = itemsInDataCart;
appState.country = buyerCountryData;
const totalBill = itemsInDataCart.reduce((currentPrice, nextPrice) => {
for (i=0; i<itemsInDataCart.length; i++){
return itemsInDataCart[i].qty * itemsInDataCart[i].price;
}
return currentPrice + nextPrice;
}, 0);
appState.bill = totalBill;
const formattedTotalBill = formatAsMoney(appState.bill,
appState.country);
document.querySelector("[data-bill]").innerTEXT = appState.billFormated;
appState.billFormated = formattedTotalBill;
uiCanInteract();
};
它应该分配所需的对象属性并调用uiCanInteract函数,但我一直收到此错误-
“在“ displayCartTotal”中,您需要将多个数据分配给“ appState”,然后调用“ uiCanInteract”。请参见说明”
怀疑的罪魁祸首–“最后,调用uiCanInteract来包装displayCartTotal”