@@ -99,8 +99,7 @@ export default {
9999 inject: [' isLeaf' , ' childChecked' , ' parentChecked' , ' nodeSelected' , ' emitEventToTree' , ' setAttr' ],
100100 computed: {
101101 itemVisible () {
102- let {visible = true } = this .item
103- // visible = visible === false ? false : true
102+ const {visible = true } = this .item
104103 return visible
105104 },
106105 hasExpended () { // 已经展开过
@@ -134,6 +133,9 @@ export default {
134133 },
135134 showNextUl () {
136135 return ! this .isLeaf (this .item ) && this .maxLevel > this .level && this .hasExpended
136+ },
137+ position () {
138+ return {level: this .level , index: this .index }
137139 }
138140 },
139141 watch: {
@@ -167,11 +169,10 @@ export default {
167169 const expended = ! node .expanded
168170 this .setAttr (node, ' expanded' , expended)
169171 this .setAttr (node, ' hasExpended' , true )
170- if (node .children || node .async ) {
171- if (node .async && ! node .children ) {
172- this .emitEventToTree (' async-load-nodes' , node)
173- }
172+ if (node .async && ! node .children ) {
173+ this .emitEventToTree (' async-load-nodes' , node)
174174 }
175+ this .emitEventToTree (' node-expand' , node, expended, this .position )
175176 },
176177 /* @event passing the node-check event to the parent component
177178 * @param node clicked node
@@ -202,7 +203,7 @@ export default {
202203 changeNodeCheckStatus (node , $event ) {
203204 const checked = $event .target .checked
204205 this .nodeCheck (node, checked)
205- this .emitEventToTree (' node-check' , node, checked, {level : this .level , index : this . index } )
206+ this .emitEventToTree (' node-check' , node, checked, this .position )
206207 },
207208 theParentChecked (checked , halfcheck ){
208209 const parentNode = this .parent
0 commit comments