File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 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 {
321321 pending ++
322322
323323 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 )
324328 match . components [ key ] = resolvedDef
325329 pending --
326330 if ( pending <= 0 && _next ) {
@@ -345,8 +349,16 @@ function resolveAsyncComponents (matched: Array<RouteRecord>): Function {
345349 } catch ( e ) {
346350 reject ( e )
347351 }
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+ }
350362 }
351363 }
352364 } )
You can’t perform that action at this time.
0 commit comments