Skip to content

Commit 79c2470

Browse files
author
黄书伟
committed
修复 table 组件checkbox 取消全选的bug
1 parent 94c03e1 commit 79c2470

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

libs/v-table/src/checkbox-selection-mixin.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ exports.default = {
1717

1818

1919
computed: {
20-
disabledChecked: function disabledChecked() {
21-
22-
var result = [];
23-
24-
this.internalTableData.filter(function (item, index) {
25-
26-
if (item._disabled && item._checked) {
27-
result.push(index);
28-
}
29-
});
30-
return result;
31-
},
3220
disabledUnChecked: function disabledUnChecked() {
3321

3422
var result = [];
@@ -52,6 +40,18 @@ exports.default = {
5240
},
5341

5442
methods: {
43+
disabledChecked: function disabledChecked() {
44+
45+
var result = [];
46+
47+
this.internalTableData.filter(function (item, index) {
48+
49+
if (item._disabled && item._checked) {
50+
result.push(index);
51+
}
52+
});
53+
return result;
54+
},
5555
handleCheckAll: function handleCheckAll() {
5656

5757
if (this.isAllChecked) {
@@ -74,7 +74,7 @@ exports.default = {
7474
this.selectAll && this.selectAll(this.getCheckedTableRow);
7575
} else {
7676

77-
this.checkboxGroupModel = this.disabledChecked;
77+
this.checkboxGroupModel = this.disabledChecked();
7878
}
7979

8080
this.setCheckAllState();

packages/v-table/src/checkbox-selection-mixin.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ export default {
1515

1616
computed: {
1717

18-
// 禁用已选中的复选框集合
19-
disabledChecked(){
20-
21-
let result = [];
22-
23-
this.internalTableData.filter((item, index) => {
24-
25-
if (item._disabled && item._checked) {
26-
result.push(index);
27-
}
28-
})
29-
return result;
30-
},
31-
3218
// 禁用未选中的复选框集合
3319
disabledUnChecked(){
3420

@@ -55,6 +41,20 @@ export default {
5541

5642
methods: {
5743

44+
// 禁用已选中的复选框集合
45+
disabledChecked(){
46+
47+
let result = [];
48+
49+
this.internalTableData.filter((item, index) => {
50+
51+
if (item._disabled && item._checked) {
52+
result.push(index);
53+
}
54+
})
55+
return result;
56+
},
57+
5858
// check all trigger event
5959
handleCheckAll(){
6060

@@ -79,7 +79,7 @@ export default {
7979

8080
} else {
8181

82-
this.checkboxGroupModel = this.disabledChecked;
82+
this.checkboxGroupModel = this.disabledChecked();
8383
}
8484

8585
this.setCheckAllState();
@@ -125,7 +125,7 @@ export default {
125125
}
126126
},
127127

128-
// 修改checkbox 选中状态
128+
// 修改checkbox 选中状态(table.vue 中调用)
129129
updateCheckboxGroupModel(){
130130

131131
this.checkboxGroupModel = [];

0 commit comments

Comments
 (0)