Browse Source

fix[litemall-wx]: 收藏删除不成功。

Junling Bu 7 years ago
parent
commit
d97bb18cdc
1 changed files with 6 additions and 2 deletions
  1. 6 2
      litemall-wx/pages/ucenter/collect/collect.js

+ 6 - 2
litemall-wx/pages/ucenter/collect/collect.js

@@ -60,7 +60,8 @@ Page({
   openGoods(event) {
     
     let that = this;
-    let goodsId = this.data.collectList[event.currentTarget.dataset.index].valueId;
+    let index = event.currentTarget.dataset.index;
+    let goodsId = this.data.collectList[index].valueId;
 
     //触摸时间距离页面打开的毫秒数  
     var touchTime = that.data.touchEnd - that.data.touchStart;
@@ -81,7 +82,10 @@ Page({
                   icon: 'success',
                   duration: 2000
                 });
-                that.getCollectList();
+                that.data.collectList.splice(index, 1)
+                that.setData({
+                  collectList: that.data.collectList
+                });
               }
             });
           }