Commit ddd864f 1 parent 4fbcd5e commit ddd864f Copy full SHA for ddd864f
File tree 3 files changed +25
-2
lines changed
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const router = new VueRouter({
29
29
// Route components will be rendered inside <router-view>.
30
30
new Vue ( {
31
31
router,
32
+ data : ( ) => ( { n : 0 } ) ,
32
33
template : `
33
34
<div id="app">
34
35
<h1>Basic</h1>
@@ -43,9 +44,22 @@ new Vue({
43
44
<li><router-link to="/é?t=%25ñ">/é?t=%ñ</router-link></li>
44
45
<li><router-link to="/é#%25ñ">/é#%25ñ</router-link></li>
45
46
</ul>
47
+ <button id="navigate-btn" @click="navigateAndIncrement">On Success</button>
48
+ <pre id="counter">{{ n }}</pre>
46
49
<pre id="query-t">{{ $route.query.t }}</pre>
47
50
<pre id="hash">{{ $route.hash }}</pre>
48
51
<router-view class="view"></router-view>
49
52
</div>
50
- `
53
+ ` ,
54
+
55
+ methods : {
56
+ navigateAndIncrement ( ) {
57
+ const increment = ( ) => this . n ++
58
+ if ( this . $route . path === '/' ) {
59
+ this . $router . push ( '/foo' , increment )
60
+ } else {
61
+ this . $router . push ( '/' , increment )
62
+ }
63
+ }
64
+ }
51
65
} ) . $mount ( '#app' )
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export function resolveAsyncComponents (matched: Array<RouteRecord>): Function {
30
30
match . components [ key ] = resolvedDef
31
31
pending --
32
32
if ( pending <= 0 ) {
33
- next ( )
33
+ next ( to )
34
34
}
35
35
} )
36
36
Original file line number Diff line number Diff line change @@ -40,6 +40,15 @@ module.exports = {
40
40
. url ( 'http://localhost:8080/basic/%C3%A9' )
41
41
. waitForElementVisible ( '#app' , 1000 )
42
42
. assert . containsText ( '.view' , 'unicode' )
43
+
44
+ // regression onComplete
45
+ // https://github.com/vuejs/vue-router/issues/2721
46
+ . assert . containsText ( '#counter' , '0' )
47
+ . click ( '#navigate-btn' )
48
+ . assert . containsText ( '#counter' , '1' )
49
+ . click ( '#navigate-btn' )
50
+ . assert . containsText ( '#counter' , '2' )
51
+
43
52
. end ( )
44
53
}
45
54
}
You can’t perform that action at this time.
0 commit comments