File tree 2 files changed +17
-5
lines changed
2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -89,21 +89,30 @@ export interface PathToRegexpOptions {
89
89
end ?: boolean
90
90
}
91
91
92
- export interface RouteConfig {
92
+ interface _RouteConfigBase {
93
93
path : string
94
94
name ?: string
95
- component ?: Component
96
- components ?: Dictionary < Component >
97
95
redirect ?: RedirectOption
98
96
alias ?: string | string [ ]
99
- children ?: RouteConfig [ ]
100
97
meta ?: any
101
98
beforeEnter ?: NavigationGuard
102
- props ?: boolean | Object | RoutePropsFunction
103
99
caseSensitive ?: boolean
104
100
pathToRegexpOptions ?: PathToRegexpOptions
105
101
}
106
102
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
+
107
116
export interface RouteRecord {
108
117
path : string
109
118
regex : RegExp
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Vue.use(VueRouter)
8
8
const Home = { template : '<div>home</div>' }
9
9
const Foo = { template : '<div>foo</div>' }
10
10
const Bar = { template : '<div>bar</div>' }
11
+ const Abc = { template : '<div>abc</div>' }
11
12
const Async = ( ) => Promise . resolve ( { template : '<div>async</div>' } )
12
13
13
14
const Hook : ComponentOptions < Vue > = {
@@ -76,6 +77,7 @@ const router = new VueRouter({
76
77
components : {
77
78
default : Foo ,
78
79
bar : Bar ,
80
+ abc : Abc ,
79
81
asyncComponent : Async
80
82
} ,
81
83
meta : { auth : true } ,
@@ -88,6 +90,7 @@ const router = new VueRouter({
88
90
props : {
89
91
default : true ,
90
92
bar : { id : 123 } ,
93
+ abc : route => route . params ,
91
94
asyncComponent : ( route : Route ) => route . params
92
95
}
93
96
} ,
You can’t perform that action at this time.
0 commit comments