首先通过接口在onload里获取到购物车数据渲染出来
然后将购物车数据保存到本地
wx.setStorageSync('cart', res.data.data[0].orderItemList)
然后在onShow里再拿出来
* 生命周期函数--监听页面显示
*/
onShow: function () {
var shoplist=wx.getStorageSync('cart')
this.setData({
shoplist:shoplist
})
this.prix()
},
就可以了