File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,7 @@ export default {
62
62
return result
63
63
},
64
64
buildTree () {
65
- console .log (' this map' , this .componentMap )
66
65
let build = this .transformToTree (this .componentMap )
67
- console .log (' build' , build)
68
66
return build[' App' ]
69
67
}
70
68
}
Original file line number Diff line number Diff line change @@ -361,20 +361,21 @@ const mutations = {
361
361
state . parentSelected = payload
362
362
} ,
363
363
[ types . DELETE_ROUTE ] : ( state , payload ) => {
364
- // const deleteChildren = (children) => {
365
- // console.log('children', children.children)
366
- // children.children.forEach((child) => {
367
- // if (!state.componentMap[child].children.length) delete state.componentMap[child];
368
- // else deleteChildren(child);
369
- // });
370
- // }
371
-
372
- // deleteChildren(state.routes[payload])
364
+ const deleteChildren = ( child ) => {
365
+ if ( state . componentMap [ child . componentName ] . children . length ) {
366
+ child . children . forEach ( ( grandchild ) => {
367
+ deleteChildren ( grandchild )
368
+ } )
369
+ }
370
+ delete state . componentMap [ child . componentName ]
371
+ }
372
+ state . routes [ payload ] . forEach ( ( child => {
373
+ deleteChildren ( child )
374
+ } ) )
373
375
374
- // const stateCopy = state
375
376
delete state . routes [ payload ]
376
377
delete state . componentMap [ payload ]
377
- // state = stateCopy
378
+
378
379
state . componentMap . App . children = state . componentMap . App . children . filter ( ( route ) => {
379
380
return route !== payload ;
380
381
} )
You can’t perform that action at this time.
0 commit comments