From d6e295db0df6b5e61130775987776b5213788924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Tue, 21 Feb 2023 01:01:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E9=80=89=E4=B8=ADbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/order/cart.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/order/cart.vue b/src/pages/order/cart.vue index e53e1f8..a8e8c09 100644 --- a/src/pages/order/cart.vue +++ b/src/pages/order/cart.vue @@ -72,6 +72,7 @@ import WidgetCheckBox from "@/components/widgets/checkbox"; import WidgetCountModify from "@/components/widgets/count-modify"; import WidgetLoadMore from "@/components/widgets/loadmore"; import ServicePreviewItem from "@/components/service/preview-item"; +import { set } from "vue"; export default { name: "order-cart", data() { @@ -139,17 +140,21 @@ export default { return newList; }, clickGroup(parentIndex) { + let state = !this.list[parentIndex].checked; this.list[parentIndex].list.forEach((item, itemIndex) => { - this.checkedItem(parentIndex, itemIndex); + this.checkedItem(parentIndex, itemIndex, state); }); }, clickItem(parentIndex, itemIndex) { this.checkedItem(parentIndex, itemIndex); }, // 选中单项 - checkedItem(parentIndex, itemIndex) { + checkedItem(parentIndex, itemIndex, state) { this.list[parentIndex].list[itemIndex].checked = - !this.list[parentIndex].list[itemIndex].checked; + typeof state === "undefined" + ? !this.list[parentIndex].list[itemIndex].checked + : state; + // 判断是否需要选中组 let allChecked = true; this.list[parentIndex].list.forEach((item, index) => { if (!item.checked) {