First obtain the shopping cart data in onload through the interface and render it,
and then save the shopping cart data locally
wx.setStorageSync('cart', res.data.data[0].orderItemList)
Then take it out in onShow
* 生命周期函数--监听页面显示
*/
onShow: function () {
var shoplist=wx.getStorageSync('cart')
this.setData({
shoplist:shoplist
})
this.prix()
},
That's it