File tree 5 files changed +45
-14
lines changed
5 files changed +45
-14
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ const IndexChild2 = { template: '<div>index child2</div>' }
27
27
28
28
const Home = { template : '<div>home</div>' }
29
29
30
+ const ViewWithKeepalive = { template : '<keep-alive><router-view></router-view></keep-alive>' }
31
+
30
32
const router = new VueRouter ( {
31
33
mode : 'history' ,
32
34
base : __dirname ,
@@ -58,6 +60,26 @@ const router = new VueRouter({
58
60
path : '/with-guard2' ,
59
61
name : 'with-guard2' ,
60
62
component : WithGuard
63
+ } ,
64
+ {
65
+ path : '/one' ,
66
+ component : ViewWithKeepalive ,
67
+ children : [
68
+ {
69
+ path : 'two' ,
70
+ component : ViewWithKeepalive ,
71
+ children : [
72
+ {
73
+ path : 'child1' ,
74
+ component : IndexChild1
75
+ } ,
76
+ {
77
+ path : 'child2' ,
78
+ component : IndexChild2
79
+ }
80
+ ]
81
+ }
82
+ ]
61
83
}
62
84
]
63
85
} )
@@ -72,6 +94,8 @@ new Vue({
72
94
<li><router-link to="/home">/home</router-link></li>
73
95
<li><router-link to="/with-guard1">/with-guard1</router-link></li>
74
96
<li><router-link to="/with-guard2">/with-guard2</router-link></li>
97
+ <li><router-link to="/one/two/child1">/one/two/child1</router-link></li>
98
+ <li><router-link to="/one/two/child2">/one/two/child2</router-link></li>
75
99
</ul>
76
100
<keep-alive>
77
101
<router-view class="view"></router-view>
Original file line number Diff line number Diff line change 62
62
"babel-preset-flow-vue" : " ^1.0.0" ,
63
63
"browserstack-local" : " ^1.4.0" ,
64
64
"buble" : " ^0.19.8" ,
65
- "chromedriver" : " ^76 .0.0" ,
65
+ "chromedriver" : " ^79 .0.0" ,
66
66
"conventional-changelog-cli" : " ^2.0.11" ,
67
67
"cross-spawn" : " ^6.0.5" ,
68
68
"css-loader" : " ^2.1.1" ,
Original file line number Diff line number Diff line change @@ -26,14 +26,12 @@ export default {
26
26
let depth = 0
27
27
let inactive = false
28
28
while ( parent && parent . _routerRoot !== parent ) {
29
- const vnodeData = parent . $vnode && parent . $vnode . data
30
- if ( vnodeData ) {
31
- if ( vnodeData . routerView ) {
32
- depth ++
33
- }
34
- if ( vnodeData . keepAlive && parent . _inactive ) {
35
- inactive = true
36
- }
29
+ const vnodeData = parent . $vnode ? parent . $vnode . data : { }
30
+ if ( vnodeData . routerView ) {
31
+ depth ++
32
+ }
33
+ if ( vnodeData . keepAlive && parent . _directInactive && parent . _inactive ) {
34
+ inactive = true
37
35
}
38
36
parent = parent . $parent
39
37
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module.exports = {
9
9
browser
10
10
. url ( 'http://localhost:8080/keepalive-view/' )
11
11
. waitForElementVisible ( '#app' , 1000 )
12
- . assert . count ( 'li a' , 5 )
12
+ . assert . count ( 'li a' , 7 )
13
13
14
14
. click ( 'li:nth-child(1) a' )
15
15
. assert . containsText ( '.view' , 'index child1' )
@@ -35,6 +35,15 @@ module.exports = {
35
35
. click ( 'li:nth-child(4) a' )
36
36
. assert . containsText ( '.view' , 'with-guard1: 3' )
37
37
38
+ // keep-alive deeply nested router-views
39
+ // https://github.com/vuejs/vue-router/issues/2923
40
+ . click ( 'li:nth-child(6) a' )
41
+ . assert . containsText ( '.view' , 'index child1' )
42
+ . click ( 'li:nth-child(3) a' )
43
+ . assert . containsText ( '.view' , 'home' )
44
+ . click ( 'li:nth-child(7) a' )
45
+ . assert . containsText ( '.view' , 'index child2' )
46
+
38
47
. end ( )
39
48
}
40
49
}
Original file line number Diff line number Diff line change @@ -2701,10 +2701,10 @@ chrome-trace-event@^1.0.2:
2701
2701
dependencies :
2702
2702
tslib "^1.9.0"
2703
2703
2704
- chromedriver@^76 .0.0 :
2705
- version "76 .0.0"
2706
- resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-76 .0.0.tgz#cbf618c5b370799ff6e15b23de07e80f67f89025 "
2707
- integrity sha512-jGyqs0N+lMo9iaNQxGKNPiLJWb2L9s2rwbRr1jJeQ37n6JQ1+5YMGviv/Fx5Z08vBWYbAvrKEzFsuYf8ppl+lw ==
2704
+ chromedriver@^79 .0.0 :
2705
+ version "79 .0.0"
2706
+ resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-79 .0.0.tgz#1660ac29924dfcd847911025593d6b6746aeea35 "
2707
+ integrity sha512-DO29C7ntJfzu6q1vuoWwCON8E9x5xzopt7Q41A7Dr7hBKcdNpGw1l9DTt9b+l1qviOWiJLGsD+jHw21ptEHubA ==
2708
2708
dependencies :
2709
2709
del "^4.1.1"
2710
2710
extract-zip "^1.6.7"
You can’t perform that action at this time.
0 commit comments