File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -89,21 +89,30 @@ export interface PathToRegexpOptions {
8989 end ?: boolean
9090}
9191
92- export interface RouteConfig {
92+ interface _RouteConfigBase {
9393 path : string
9494 name ?: string
95- component ?: Component
96- components ?: Dictionary < Component >
9795 redirect ?: RedirectOption
9896 alias ?: string | string [ ]
99- children ?: RouteConfig [ ]
10097 meta ?: any
10198 beforeEnter ?: NavigationGuard
102- props ?: boolean | Object | RoutePropsFunction
10399 caseSensitive ?: boolean
104100 pathToRegexpOptions ?: PathToRegexpOptions
105101}
106102
103+ interface RouteConfigSingleView extends _RouteConfigBase {
104+ component ?: Component
105+ props ?: boolean | Object | RoutePropsFunction
106+ }
107+
108+ interface RouteConfigMultipleViews extends _RouteConfigBase {
109+ components ?: Dictionary < Component >
110+ children ?: RouteConfig [ ]
111+ props ?: Dictionary < boolean | Object | RoutePropsFunction >
112+ }
113+
114+ export type RouteConfig = RouteConfigSingleView | RouteConfigMultipleViews
115+
107116export interface RouteRecord {
108117 path : string
109118 regex : RegExp
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Vue.use(VueRouter)
88const Home = { template : '<div>home</div>' }
99const Foo = { template : '<div>foo</div>' }
1010const Bar = { template : '<div>bar</div>' }
11+ const Abc = { template : '<div>abc</div>' }
1112const Async = ( ) => Promise . resolve ( { template : '<div>async</div>' } )
1213
1314const Hook : ComponentOptions < Vue > = {
@@ -76,6 +77,7 @@ const router = new VueRouter({
7677 components : {
7778 default : Foo ,
7879 bar : Bar ,
80+ abc : Abc ,
7981 asyncComponent : Async
8082 } ,
8183 meta : { auth : true } ,
@@ -88,6 +90,7 @@ const router = new VueRouter({
8890 props : {
8991 default : true ,
9092 bar : { id : 123 } ,
93+ abc : route => route . params ,
9194 asyncComponent : ( route : Route ) => route . params
9295 }
9396 } ,
You can’t perform that action at this time.
0 commit comments