MCPcopy Create free account
hub / github.com/coderwhy/HYMiniMall / onAddCart

Function onAddCart

pages/detail/detail.js:78–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 })
77 },
78 onAddCart() {
79 // 1.获取商品对象
80 const obj = {}
81 obj.iid = this.data.iid;
82 obj.imageURL = this.data.topImages[0];
83 obj.title = this.data.baseInfo.title;
84 obj.desc = this.data.baseInfo.desc;
85 obj.price = this.data.baseInfo.realPrice;
86
87 // 2.加入到购物车列表
88 app.addToCart(obj)
89
90 // 3.加入成功提示
91 wx.showToast({
92 title: '加入购物车成功',
93 })
94 }
95})

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected