diff --git a/src/pages/cart/cart.vue b/src/pages/cart/cart.vue index 5239e63..4a02d27 100644 --- a/src/pages/cart/cart.vue +++ b/src/pages/cart/cart.vue @@ -15,7 +15,7 @@ - + 全选 合计: 3999 @@ -28,12 +28,14 @@ export default { data(){ return { - cartList: [] + cartList: [], + selectAll: false } }, onShow() { const cartList = uni.getStorageSync("cartList") || []; this.cartList = cartList + this.selectAll = this.cartList.every(item=>item.goods_select === true) }, methods: { // 商品选择按钮切换 @@ -42,6 +44,9 @@ export default { // this.cartList[index].goods_select = !this.cartList[index].goods_select const index = this.cartList.findIndex(item=>item.goods_id === goods_id) this.cartList[index].goods_select = !this.cartList[index].goods_select + + // 判断全选 + this.selectAll = this.cartList.every(item=>item.goods_select === true) } }, }