From ce2539f9839ed812bfbfcc504c92fd4dba626cc8 Mon Sep 17 00:00:00 2001 From: "jqtmviyu@gmail.com" Date: Thu, 4 Mar 2021 23:30:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E9=80=89=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cart/cart.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) } }, }