@@ -34,32 +34,25 @@ export default {
34
34
data ( ) {
35
35
return {
36
36
expand : false ,
37
- checkAll : false ,
38
37
localCheckAll : false ,
39
- items : [ ] ,
38
+ items : this . getItemsKey ( filterEmpty ( this . $slots . default ) ) ,
40
39
val : this . value || this . defaultValue || [ ]
41
40
}
42
41
} ,
43
42
methods : {
44
43
onChange ( checked ) {
45
44
const key = Object . keys ( this . items ) . filter ( key => key === checked . value )
46
45
this . items [ key ] = checked . checked
47
- // console.log(this.items)
48
46
const bool = Object . values ( this . items ) . lastIndexOf ( false )
49
- console . log ( 'bool' , bool , 'this.checkAll' , this . checkAll )
50
47
if ( bool === - 1 ) {
51
- ! this . checkAll && ( this . checkAll = true )
48
+ this . localCheckAll = true
52
49
} else {
53
- this . checkAll && ( this . checkAll = false )
54
50
this . localCheckAll = false
55
51
}
56
52
} ,
57
53
onCheckAll ( checked ) {
58
- this . checkAll = checked . checked
59
- // Object.keys(this.items)
60
- // this.items[k] = checked.checked
61
- Object . values ( this . items ) . forEach ( v => {
62
- v = checked . checked
54
+ Object . keys ( this . items ) . forEach ( v => {
55
+ this . items [ v ] = checked . checked
63
56
} )
64
57
} ,
65
58
getItemsKey ( items ) {
@@ -99,8 +92,6 @@ export default {
99
92
[ `${ prefixCls } ` ] : true
100
93
}
101
94
const tagItems = filterEmpty ( this . $slots . default )
102
- this . items = this . getItemsKey ( tagItems )
103
- console . log ( this . items )
104
95
return (
105
96
< div class = { classString } >
106
97
{ this . renderCheckAll ( ) }
0 commit comments