购物车商品数量

parent 66413769
......@@ -190,10 +190,11 @@ const addOrderFn = () => {
// 获取购物车列表
const getshoppingCartListFn = () => {
getshoppingCartList({}).then((res) => {
res.data.forEach((item) => {
// item.img = imgUrl + item.img;
});
subscript.value = res.data.length;
// 累加prodInfos长度
const totalLength = res.data.reduce((accumulator, current) => {
return accumulator + (current.prodInfos ? current.prodInfos.length : 0);
}, 0);
subscript.value = totalLength;
});
};
// 进入页面回到顶部
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment