修复购物车选中bug
This commit is contained in:
parent
7c9e474871
commit
d6e295db0d
|
@ -72,6 +72,7 @@ import WidgetCheckBox from "@/components/widgets/checkbox";
|
||||||
import WidgetCountModify from "@/components/widgets/count-modify";
|
import WidgetCountModify from "@/components/widgets/count-modify";
|
||||||
import WidgetLoadMore from "@/components/widgets/loadmore";
|
import WidgetLoadMore from "@/components/widgets/loadmore";
|
||||||
import ServicePreviewItem from "@/components/service/preview-item";
|
import ServicePreviewItem from "@/components/service/preview-item";
|
||||||
|
import { set } from "vue";
|
||||||
export default {
|
export default {
|
||||||
name: "order-cart",
|
name: "order-cart",
|
||||||
data() {
|
data() {
|
||||||
|
@ -139,17 +140,21 @@ export default {
|
||||||
return newList;
|
return newList;
|
||||||
},
|
},
|
||||||
clickGroup(parentIndex) {
|
clickGroup(parentIndex) {
|
||||||
|
let state = !this.list[parentIndex].checked;
|
||||||
this.list[parentIndex].list.forEach((item, itemIndex) => {
|
this.list[parentIndex].list.forEach((item, itemIndex) => {
|
||||||
this.checkedItem(parentIndex, itemIndex);
|
this.checkedItem(parentIndex, itemIndex, state);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
clickItem(parentIndex, itemIndex) {
|
clickItem(parentIndex, itemIndex) {
|
||||||
this.checkedItem(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 =
|
||||||
!this.list[parentIndex].list[itemIndex].checked;
|
typeof state === "undefined"
|
||||||
|
? !this.list[parentIndex].list[itemIndex].checked
|
||||||
|
: state;
|
||||||
|
// 判断是否需要选中组
|
||||||
let allChecked = true;
|
let allChecked = true;
|
||||||
this.list[parentIndex].list.forEach((item, index) => {
|
this.list[parentIndex].list.forEach((item, index) => {
|
||||||
if (!item.checked) {
|
if (!item.checked) {
|
||||||
|
|
Loading…
Reference in New Issue