Skip to content

Commit 0bcc34e

Browse files
committed
fix(router-view): add condition to see whether the tree is inactive
close vuejs#2552
1 parent 2191ee1 commit 0bcc34e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: src/components/view.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ export default {
2626
let depth = 0
2727
let inactive = false
2828
while (parent && parent._routerRoot !== parent) {
29-
if (parent.$vnode && parent.$vnode.data.routerView) {
30-
depth++
31-
}
32-
if (parent._inactive) {
33-
inactive = true
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+
}
3437
}
3538
parent = parent.$parent
3639
}

0 commit comments

Comments
 (0)