File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 99
1010[libs]
1111flow
12+
13+ [options]
14+ unsafe.enable_getters_and_setters=true
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ export default class VueRouter {
3838 this . mode = mode
3939 }
4040
41+ get currentRoute ( ) : ?Route {
42+ return this . history && this . history . current
43+ }
44+
4145 init ( app : any /* Vue component instance */ ) {
4246 assert (
4347 install . installed ,
@@ -103,6 +107,17 @@ export default class VueRouter {
103107 this . app . _route = route
104108 }
105109 }
110+
111+ getMatchedComponents ( ) : Array < any > {
112+ if ( ! this . currentRoute ) {
113+ return [ ]
114+ }
115+ return [ ] . concat . apply ( [ ] , this . currentRoute . matched . map ( m => {
116+ return Object . keys ( m . components ) . map ( key => {
117+ return m . components [ key ]
118+ } )
119+ } ) )
120+ }
106121}
107122
108123VueRouter . install = install
You can’t perform that action at this time.
0 commit comments