Browse Source

!78 购物车商品数量减为0时,删除错误
Merge pull request !78 from 邓飞鹏/master

芋道源码 8 months ago
parent
commit
c6b55dc90b
1 changed files with 7 additions and 1 deletions
  1. 7 1
      sheep/store/cart.js

+ 7 - 1
sheep/store/cart.js

@@ -57,7 +57,13 @@ const cart = defineStore({
 
 
     // 移除购物车
     // 移除购物车
     async delete(ids) {
     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) {
       if (code === 0) {
         await this.getList();
         await this.getList();
       }
       }