1
1
import Vue = require( "vue" ) ;
2
- import { ComponentOptions } from "vue" ;
2
+ import { ComponentOptions , AsyncComponent } from "vue" ;
3
3
4
4
import VueRouter = require( "../index" ) ;
5
5
import { Route , RouteRecord , RedirectOption } from "../index" ;
@@ -9,7 +9,7 @@ Vue.use(VueRouter);
9
9
const Home = { template : "<div>home</div>" } ;
10
10
const Foo = { template : "<div>foo</div>" } ;
11
11
const Bar = { template : "<div>bar</div>" } ;
12
- const AsyncComponent = ( ) => Promise . resolve ( { template : "<div>async</div>" } )
12
+ const Async = ( ) => Promise . resolve ( { template : "<div>async</div>" } )
13
13
14
14
const Hook : ComponentOptions < Vue > = {
15
15
template : "<div>hook</div>" ,
@@ -68,7 +68,7 @@ const router = new VueRouter({
68
68
components : {
69
69
default : Foo ,
70
70
bar : Bar ,
71
- asyncComponent : AsyncComponent ,
71
+ asyncComponent : Async ,
72
72
} ,
73
73
meta : { auth : true } ,
74
74
beforeEnter ( to , from , next ) {
@@ -111,7 +111,7 @@ const matched: RouteRecord[] = route.matched;
111
111
matched . forEach ( m => {
112
112
const path : string = m . path ;
113
113
const components : {
114
- [ key : string ] : ComponentOptions < Vue > | typeof Vue
114
+ [ key : string ] : ComponentOptions < Vue > | typeof Vue | AsyncComponent
115
115
} = m . components ;
116
116
const instances : { [ key : string ] : Vue } = m . instances ;
117
117
const name : string | undefined = m . name ;
@@ -163,7 +163,7 @@ router.go(-1);
163
163
router . back ( ) ;
164
164
router . forward ( ) ;
165
165
166
- const Components : ( ComponentOptions < Vue > | typeof Vue ) [ ] = router . getMatchedComponents ( ) ;
166
+ const Components : ( ComponentOptions < Vue > | typeof Vue | AsyncComponent ) [ ] = router . getMatchedComponents ( ) ;
167
167
168
168
const vm = new Vue ( {
169
169
router,
0 commit comments