Browse Source

bug修复

chenrui 3 years ago
parent
commit
44eca10577
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/components/Table/index.js

+ 9 - 9
src/components/Table/index.js

@@ -275,17 +275,17 @@ export default {
       if (selected) { //  选择
         this.selectedRows = [...this.selectedRows, ...changeRows]
       } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item[this.rowKeyName] == subItem[this.rowKeyName]) {
-              arrId.push(index)
-            }
-          })
+        const arrIds = []
+        changeRows.map((item, index) => {
+          arrIds.push(item[this.rowKeyName])
         })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
+        const arrs = []
+        this.selectedRows.map((item, index) => {
+          if (arrIds.indexOf(item[this.rowKeyName]) == -1) {
+            arrs.push(item)
+          }
         })
+        this.selectedRows = arrs
       }
       this.updateSelect()
     },