gistfile1.txt //点击删除按钮事件 delItem: function (e) { var that = this; //获取列表中要删除项的下标 var index = e.target.dataset.index; var refactivityid = e.target.dataset.refactivityid; var list = that.data.result; va
//点击删除按钮事件 delItem: function (e) { var that = this; //获取列表中要删除项的下标 var index = e.target.dataset.index; var refactivityid = e.target.dataset.refactivityid; var list = that.data.result; var imgs = that.data.imgs; var collectionNum = wx.getStorageSync('collectionNum'); for (let i = collectionNum; i > 0; i--) { var coll = 'collection' + i; var collection = wx.getStorageSync(coll); if (collection.refActivityId == refactivityid) { wx.setStorageSync(coll, ''); } } var idlist = wx.getStorageSync('idlist'); idlist = idlist.replace(refactivityid,''); wx.setStorageSync('idlist', idlist) list.splice(index, 1);//移除列表中下标为index的项 imgs.splice(index, 1);//移除列表中下标为index的项 that.setData({ result: list, imgs, }); },