Explorar el Código

more robust parent transition skip check

Evan You hace 9 años
padre
commit
f764db4b01
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. 9 1
      src/platforms/web/runtime/components/transition.js

+ 9 - 1
src/platforms/web/runtime/components/transition.js

@@ -54,6 +54,14 @@ function placeholder (h, rawChild) {
     : null
 }
 
+function hasParentTransition (vnode) {
+  while ((vnode = vnode.parent)) {
+    if (vnode.data.transition) {
+      return true
+    }
+  }
+}
+
 export default {
   name: 'transition',
   props: transitionProps,
@@ -95,7 +103,7 @@ export default {
 
     // if this is a component root node and the component's
     // parent container node also has transition, skip.
-    if (this.$vnode.parent && this.$vnode.parent.data.transition) {
+    if (hasParentTransition(this.$vnode)) {
       return rawChild
     }