File tree Expand file tree Collapse file tree 3 files changed +34
-31
lines changed Expand file tree Collapse file tree 3 files changed +34
-31
lines changed Original file line number Diff line number Diff line change @@ -19,32 +19,37 @@ export default {
19
19
return frame . goBack ( )
20
20
}
21
21
Vue . navigateTo = Vue . prototype . $navigateTo = function ( component , options ) {
22
- const placeholder = Vue . $document . createComment ( 'placeholder' )
22
+ return new Promise ( resolve => {
23
+ const placeholder = Vue . $document . createComment ( 'placeholder' )
23
24
24
- const contentComponent = Vue . extend ( component )
25
- const vm = new contentComponent ( options . context )
26
- vm . $mount ( placeholder )
25
+ const contentComponent = Vue . extend ( component )
26
+ const vm = new contentComponent ( options . context )
27
+ vm . $mount ( placeholder )
27
28
28
- const toPage = isPage ( vm . $el ) ? vm . $el . nativeView : new Page ( )
29
+ const toPage = isPage ( vm . $el ) ? vm . $el . nativeView : new Page ( )
29
30
30
- if ( ! isPage ( vm . $el ) ) {
31
- toPage . content = vm . $el . nativeView
32
- }
33
-
34
- toPage [ VUE_VM_REF ] = vm
31
+ if ( ! isPage ( vm . $el ) ) {
32
+ toPage . content = vm . $el . nativeView
33
+ }
35
34
36
- const frame = topmost ( )
37
- const navigate = frame ? frame . navigate : start
38
-
39
- navigate . call (
40
- frame ,
41
- Object . assign (
42
- {
43
- create : ( ) => toPage
44
- } ,
45
- options
35
+ toPage [ VUE_VM_REF ] = vm
36
+
37
+ const frame = topmost ( )
38
+ const navigate = frame ? frame . navigate : start
39
+
40
+ navigate . call (
41
+ frame ,
42
+ Object . assign (
43
+ {
44
+ create : ( ) => {
45
+ resolve ( toPage )
46
+ return toPage
47
+ }
48
+ } ,
49
+ options
50
+ )
46
51
)
47
- )
52
+ } )
48
53
}
49
54
}
50
55
}
Original file line number Diff line number Diff line change @@ -44,13 +44,13 @@ export default {
44
44
this . $navigateTo ( initial , {
45
45
context : { router } ,
46
46
clearHistory : true
47
- } )
48
-
49
- // Mount the root component (Should be <router-page>) to register router hooks
50
- this . $nextTick ( ( ) => {
51
- const placeholder = this . $document . createComment ( 'placeholder' )
47
+ } ) . then ( ( ) => {
48
+ // Mount the root component (Should be <router-page>) to register router hooks
49
+ this . $nextTick ( ( ) => {
50
+ const placeholder = this . $document . createComment ( 'placeholder' )
52
51
53
- this . $mount ( placeholder )
52
+ this . $mount ( placeholder )
53
+ } )
54
54
} )
55
55
}
56
56
}
Original file line number Diff line number Diff line change @@ -16,10 +16,8 @@ export default {
16
16
router . afterEach ( ( { matched } ) => {
17
17
const component = matched [ 0 ] . components . default
18
18
19
- parent . $nextTick ( ( ) => {
20
- parent . $navigateTo ( component , {
21
- context : { router }
22
- } )
19
+ parent . $navigateTo ( component , {
20
+ context : { router }
23
21
} )
24
22
} )
25
23
You can’t perform that action at this time.
0 commit comments