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

Function onSelectAll

pages/cart/cart.js:47–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 this.changeData()
46 },
47 onSelectAll() {
48 // 1.判断是否是全部选中
49 if (this.data.isSelectAll) { // 目前全部选中
50 this.data.cartList.forEach(item => {
51 item.checked = false
52 })
53 this.setData({
54 cartList: this.data.cartList,
55 isSelectAll: false
56 })
57 } else { // 某些没选中
58 this.data.cartList.forEach(item => {
59 item.checked = true
60 })
61 this.setData({
62 cartList: this.data.cartList,
63 isSelectAll: true
64 })
65 }
66 },
67 changeData() {
68 // 1.获取所有选中数据
69 let totalPrice = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected