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

Function changeData

pages/cart/cart.js:67–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 }
66 },
67 changeData() {
68 // 1.获取所有选中数据
69 let totalPrice = 0;
70 let counter = 0;
71
72 for (let item of this.data.cartList) {
73 if (item.checked) {
74 counter++
75 totalPrice += item.price * item.count
76 }
77 }
78
79 console.log(counter, totalPrice)
80
81 // 2.修改数据
82 this.setData({
83 totalCounter: counter,
84 totalPrice: totalPrice
85 })
86 }
87})

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected