File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 33 "description" : " Yet another Vue treeview component." ,
44 "author" : " Gregg Rapoza <grapoza@gmail.com>" ,
55 "license" : " MIT" ,
6- "version" : " 1.3.3 " ,
6+ "version" : " 1.3.4 " ,
77 "browser" : " index.js" ,
88 "repository" : {
99 "url" : " https://github.com/grapoza/vue-tree" ,
Original file line number Diff line number Diff line change 318318 $_treeViewNode_getIdPropNameForNode (node) {
319319 return this .idPropNames .find (pn => typeof node[pn] === ' number' || typeof node[pn] === ' string' );
320320 },
321+ $_treeViewNode_getChildrenPropNameForNode (node) {
322+ return this .childrenPropNames .find (pn => Array .isArray (node[pn])) || ' children' ;
323+ },
321324 /*
322325 * Normalizes the data model to the format consumable by TreeViewNode.
323326 */
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ export default {
157157 else {
158158 let lastModel = this . model [ this . childrenPropName ] [ childIndex - 1 ] ;
159159 while ( lastModel . children . length > 0 && lastModel . expandable && lastModel . state . expanded ) {
160- lastModel = lastModel . children [ lastModel . children . length - 1 ] ;
160+ lastModel = lastModel [ this . $_treeViewNode_getChildrenPropNameForNode ( lastModel ) ] [ lastModel . children . length - 1 ] ;
161161 }
162162
163163 lastModel . focusable = true ;
@@ -169,7 +169,7 @@ export default {
169169 // Otherwise, punt this up to this node's parent
170170 let childIndex = this . model [ this . childrenPropName ] . indexOf ( childNode ) ;
171171 if ( ! ignoreChild && childNode . children . length > 0 && childNode . expandable && childNode . state . expanded ) {
172- childNode . children [ 0 ] . focusable = true ;
172+ childNode [ this . $_treeViewNode_getChildrenPropNameForNode ( childNode ) ] [ 0 ] . focusable = true ;
173173 }
174174 else if ( childIndex < this . model [ this . childrenPropName ] . length - 1 ) {
175175 this . model [ this . childrenPropName ] [ childIndex + 1 ] . focusable = true ;
You can’t perform that action at this time.
0 commit comments