购物车商品数量减为0时,删除错误

pull/78/head
D 2024-08-13 21:57:04 +08:00
parent 4db992d3fa
commit b22cdae4fe
1 changed files with 7 additions and 1 deletions

View File

@ -57,7 +57,13 @@ const cart = defineStore({
// 移除购物车
async delete(ids) {
const { code } = await CartApi.deleteCart(ids.join(','));
let idsTemp = '';
if (Array.isArray(ids)) {
idsTemp = ids.join(',');
} else {
idsTemp = ids;
}
const { code } = await CartApi.deleteCart(idsTemp);
if (code === 0) {
await this.getList();
}