const app = getApp(); Component({ data: { recommandBrand: [], brandList: [], brandForm: { brand: '' }, history: [], }, methods: { toBrandInsight(e) { let name = e.currentTarget.dataset.id.brandname; //获取点击的name let img = e.currentTarget.dataset.id.img; let obj = { brandname: name, img: e.currentTarget.dataset.id.img }; if(wx.getStorageSync('historyBrand').length == 0) { let arr = [obj]; wx.setStorageSync('historyBrand', arr); this.setData({history: arr}) } else { let o = { brandname: name, img: e.currentTarget.dataset.id.img } let isAdded = false; for(let i=0;i{ wx.hideToast(); },500) }); }, }, })