File tree 4 files changed +15
-4
lines changed
4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ declare type RouterOptions = {
48
48
49
49
declare type RedirectOption = RawLocation | ( ( to : Route ) => RawLocation )
50
50
51
+ type RoutePropsFunction = ( route : Route ) => Object
52
+
51
53
declare type RouteConfig = {
52
54
path : string ;
53
55
name ? : string ;
@@ -58,7 +60,7 @@ declare type RouteConfig = {
58
60
children ?: Array < RouteConfig > ;
59
61
beforeEnter ? : NavigationGuard ;
60
62
meta ? : any ;
61
- props ? : boolean | Object | Function ;
63
+ props ?: boolean | Object | RoutePropsFunction | Dictionary < boolean | Object | RoutePropsFunction > ;
62
64
caseSensitive ?: boolean ;
63
65
pathToRegexpOptions ? : PathToRegexpOptions ;
64
66
}
@@ -74,7 +76,7 @@ declare type RouteRecord = {
74
76
matchAs: ?string ;
75
77
beforeEnter: ?NavigationGuard ;
76
78
meta: any ;
77
- props: boolean | Object | Function | Dictionary < boolean | Object | Function > ;
79
+ props: Dictionary < boolean | Object | RoutePropsFunction > ;
78
80
}
79
81
80
82
declare type Location = {
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ function addRouteRecord (
84
84
props : route . props == null
85
85
? { }
86
86
: route . components
87
+ // $flow-disable-line
87
88
? route . props
88
89
: { default : route . props }
89
90
}
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export interface RouteConfig {
81
81
children ?: RouteConfig [ ] ;
82
82
meta ?: any ;
83
83
beforeEnter ?: NavigationGuard ;
84
- props ?: boolean | Object | RoutePropsFunction ;
84
+ props ?: boolean | Object | RoutePropsFunction | Dictionary < boolean | Object | RoutePropsFunction > ;
85
85
caseSensitive ?: boolean ;
86
86
pathToRegexpOptions ?: PathToRegexpOptions ;
87
87
}
@@ -101,7 +101,7 @@ export interface RouteRecord {
101
101
redirect : ( location : RawLocation ) => void ,
102
102
next : ( ) => void
103
103
) => any ;
104
- props : boolean | Object | RoutePropsFunction | Dictionary < boolean | Object | RoutePropsFunction > ;
104
+ props : Dictionary < boolean | Object | RoutePropsFunction > ;
105
105
}
106
106
107
107
export interface Location {
Original file line number Diff line number Diff line change @@ -80,6 +80,11 @@ const router = new VueRouter({
80
80
from . params ;
81
81
next ( { name : "home" } ) ;
82
82
next ( ) ;
83
+ } ,
84
+ props : {
85
+ default : true ,
86
+ bar : { id : 123 } ,
87
+ asyncComponent : ( route : Route ) => route . params
83
88
}
84
89
} ,
85
90
{
@@ -121,6 +126,9 @@ matched.forEach(m => {
121
126
const name : string | undefined = m . name ;
122
127
const parant : RouteRecord | undefined = m . parent ;
123
128
const redirect : RedirectOption | undefined = m . redirect ;
129
+ const props : {
130
+ [ key : string ] : boolean | Object | ( ( route : Route ) => Object )
131
+ } = m . props ;
124
132
} ) ;
125
133
126
134
const unregister = router . beforeEach ( ( to , from , next ) => {
You can’t perform that action at this time.
0 commit comments