修复购物车选中bug

This commit is contained in:
TOP糯米 2023-02-21 01:01:30 +08:00
parent 7c9e474871
commit d6e295db0d
1 changed files with 8 additions and 3 deletions

View File

@ -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) {