diff --git a/src/pages/service/cart.vue b/src/pages/service/cart.vue index a5869f4..4a2ecdd 100644 --- a/src/pages/service/cart.vue +++ b/src/pages/service/cart.vue @@ -84,38 +84,44 @@ export default { cart: (state) => state.cart.cart, }), }, - onLoad() {}, - async onShow() { - await this.$store.dispatch("cart/update"); - this.list = []; - this.cart.list.forEach((item) => { - let goods = []; - item.good.forEach((v) => { - goods.push({ - id: v.gid, - name: v.title, - times: v.post_hits, - cover: v.thumbnail, - price: v.money, - number: v.number, - checked: false, - }); - }); - this.list.push({ - name: item.cate, - total: 0, - list: goods, - checked: false, - canUse: false, - }); - }); + onLoad() { + this.initPage(); }, + onShow() {}, onReady() {}, onReachBottom() {}, onPullDownRefresh() {}, onShareTimeline() {}, onShareAppMessage() {}, methods: { + /** + * 初始化页面 + */ + async initPage() { + await this.$store.dispatch("cart/update"); + this.list = []; + this.cart.list.forEach((item) => { + let goods = []; + item.good.forEach((v) => { + goods.push({ + id: v.gid, + name: v.title, + times: v.post_hits, + cover: v.thumbnail, + price: v.money, + number: v.number, + checked: false, + }); + }); + this.list.push({ + name: item.cate, + total: 0, + list: goods, + checked: false, + canUse: false, + }); + }); + }, /** * 选中组 */