ZaiZai 1 anno fa
parent
commit
170b6c4943
1 ha cambiato i file con 15 aggiunte e 8 eliminazioni
  1. 15 8
      pages/image/view.vue

+ 15 - 8
pages/image/view.vue

@@ -199,32 +199,39 @@ const deleteTap = () => {
 
 //点击选中
 const checkList = ref([])
-const checkClick = (item, index, indexs) => {
+const checkClick = (item) => {
     const list = checkList.value
-    /*const index = arrIndex(list, 'id', item.id)
+    const index = arrIndex(list, 'id', item.id)
     if (item.check) {
         list.splice(index, 1)
         item.check = false
     } else {
         item.check = true
         list.push(item)
-    }*/
+    }
     checkList.value = list
 }
 
 //全选
 const allCheckClick = () => {
     const check = checkList.value, list = dataList.value
+    const arr = imageList.value
     if (check.length === list.length) {
-        list.forEach(item => {
-            item.check = false
+        arr.forEach(item => {
+            item.child.forEach(items => {
+                items.check = false
+            })
         })
         checkList.value = []
     } else {
-        list.forEach(item => {
-            item.check = true
+        let newArr = []
+        arr.forEach(item => {
+            item.child.forEach(items => {
+                items.check = true
+                newArr.push(items)
+            })
         })
-        checkList.value = deepClone(list)
+        checkList.value = newArr
     }
 }