//获取商品信息。根据recommend goods_list_by_recommend(recommend) { goods_list_by_recommend(recommend, this.data.goods[recommend].page,this.data.limit).then(res => { console.log(res) const list = res.data if(list.length<=0){ console.log('没有内容,防止page++') return; } //或者做遍历 push // ...list是把list展开,一个放到goods[type].list //this.data.goods[type].list.push(...list); const oldList = this.data.goods[recommend].list; oldList.push(...list) //这不是小分号,而是1左边的符号 const goodsListKey = `goods.${recommend}.list`; const pageKey = `goods.${recommend}.page`; let page = this.data.goods[recommend].page + 1 this.setData({ [goodsListKey]: oldList, [pageKey]: page, }) }) },
站长微信:xiaomao0055
站长QQ:14496453