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 9
9
10
10
[libs]
11
11
flow
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 {
38
38
this . mode = mode
39
39
}
40
40
41
+ get currentRoute ( ) : ?Route {
42
+ return this . history && this . history . current
43
+ }
44
+
41
45
init ( app : any /* Vue component instance */ ) {
42
46
assert (
43
47
install . installed ,
@@ -103,6 +107,17 @@ export default class VueRouter {
103
107
this . app . _route = route
104
108
}
105
109
}
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
+ }
106
121
}
107
122
108
123
VueRouter . install = install
You can’t perform that action at this time.
0 commit comments