File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,10 @@ function resolveAsyncComponents (matched: Array<RouteRecord>): Function {
321
321
pending ++
322
322
323
323
const resolve = once ( resolvedDef => {
324
+ // save resolved on async factory in case it's used elsewhere
325
+ def . resolved = typeof resolvedDef === 'function'
326
+ ? resolvedDef
327
+ : _Vue . extend ( resolvedDef )
324
328
match . components [ key ] = resolvedDef
325
329
pending --
326
330
if ( pending <= 0 && _next ) {
@@ -345,8 +349,16 @@ function resolveAsyncComponents (matched: Array<RouteRecord>): Function {
345
349
} catch ( e ) {
346
350
reject ( e )
347
351
}
348
- if ( res && typeof res . then === 'function' ) {
349
- res . then ( resolve , reject )
352
+ if ( res ) {
353
+ if ( typeof res . then === 'function' ) {
354
+ res . then ( resolve , reject )
355
+ } else {
356
+ // new syntax in Vue 2.3
357
+ const comp = res . component
358
+ if ( comp && typeof comp . then === 'function' ) {
359
+ comp . then ( resolve , reject )
360
+ }
361
+ }
350
362
}
351
363
}
352
364
} )
You can’t perform that action at this time.
0 commit comments