File tree Expand file tree Collapse file tree 5 files changed +45
-14
lines changed Expand file tree Collapse file tree 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>' }
2727
2828const  Home  =  {  template : '<div>home</div>'  } 
2929
30+ const  ViewWithKeepalive  =  {  template : '<keep-alive><router-view></router-view></keep-alive>'  } 
31+ 
3032const  router  =  new  VueRouter ( { 
3133  mode : 'history' , 
3234  base : __dirname , 
@@ -58,6 +60,26 @@ const router = new VueRouter({
5860      path : '/with-guard2' , 
5961      name : 'with-guard2' , 
6062      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+       ] 
6183    } 
6284  ] 
6385} ) 
@@ -72,6 +94,8 @@ new Vue({
7294        <li><router-link to="/home">/home</router-link></li> 
7395        <li><router-link to="/with-guard1">/with-guard1</router-link></li> 
7496        <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> 
7599      </ul> 
76100      <keep-alive> 
77101        <router-view class="view"></router-view> 
Original file line number Diff line number Diff line change 6262    "babel-preset-flow-vue" : " ^1.0.0" 
6363    "browserstack-local" : " ^1.4.0" 
6464    "buble" : " ^0.19.8" 
65-     "chromedriver" : " ^76 .0.0" 
65+     "chromedriver" : " ^79 .0.0" 
6666    "conventional-changelog-cli" : " ^2.0.11" 
6767    "cross-spawn" : " ^6.0.5" 
6868    "css-loader" : " ^2.1.1" 
Original file line number Diff line number Diff line change @@ -26,14 +26,12 @@ export default {
2626    let  depth  =  0 
2727    let  inactive  =  false 
2828    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 
3735      } 
3836      parent  =  parent . $parent 
3937    } 
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module.exports = {
99    browser 
1010      . url ( 'http://localhost:8080/keepalive-view/' ) 
1111      . waitForElementVisible ( '#app' ,  1000 ) 
12-       . assert . count ( 'li a' ,  5 ) 
12+       . assert . count ( 'li a' ,  7 ) 
1313
1414      . click ( 'li:nth-child(1) a' ) 
1515      . assert . containsText ( '.view' ,  'index child1' ) 
@@ -35,6 +35,15 @@ module.exports = {
3535      . click ( 'li:nth-child(4) a' ) 
3636      . assert . containsText ( '.view' ,  'with-guard1: 3' ) 
3737
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+ 
3847      . end ( ) 
3948  } 
4049} 
Original file line number Diff line number Diff line change @@ -2701,10 +2701,10 @@ chrome-trace-event@^1.0.2:
27012701  dependencies :
27022702    tslib "^1.9.0" 
27032703
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 == 
27082708  dependencies :
27092709    del "^4.1.1" 
27102710    extract-zip "^1.6.7" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments