@@ -34,32 +34,25 @@ export default {
3434 data ( ) {
3535 return {
3636 expand : false ,
37- checkAll : false ,
3837 localCheckAll : false ,
39- items : [ ] ,
38+ items : this . getItemsKey ( filterEmpty ( this . $slots . default ) ) ,
4039 val : this . value || this . defaultValue || [ ]
4140 }
4241 } ,
4342 methods : {
4443 onChange ( checked ) {
4544 const key = Object . keys ( this . items ) . filter ( key => key === checked . value )
4645 this . items [ key ] = checked . checked
47- // console.log(this.items)
4846 const bool = Object . values ( this . items ) . lastIndexOf ( false )
49- console . log ( 'bool' , bool , 'this.checkAll' , this . checkAll )
5047 if ( bool === - 1 ) {
51- ! this . checkAll && ( this . checkAll = true )
48+ this . localCheckAll = true
5249 } else {
53- this . checkAll && ( this . checkAll = false )
5450 this . localCheckAll = false
5551 }
5652 } ,
5753 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
6356 } )
6457 } ,
6558 getItemsKey ( items ) {
@@ -99,8 +92,6 @@ export default {
9992 [ `${ prefixCls } ` ] : true
10093 }
10194 const tagItems = filterEmpty ( this . $slots . default )
102- this . items = this . getItemsKey ( tagItems )
103- console . log ( this . items )
10495 return (
10596 < div class = { classString } >
10697 { this . renderCheckAll ( ) }
0 commit comments