55
66import { warn } from 'core/util/index'
77import { camelize , extend } from 'shared/util'
8- import { getRealChild , mergeVNodeHook } from 'core/vdom/helpers'
8+ import { mergeVNodeHook , getFirstComponentChild } from 'core/vdom/helpers'
99
1010export const transitionProps = {
1111 name : String ,
@@ -21,6 +21,17 @@ export const transitionProps = {
2121 appearActiveClass : String
2222}
2323
24+ // in case the child is also an abstract component, e.g. <keep-alive>
25+ // we want to recrusively retrieve the real component to be rendered
26+ function getRealChild ( vnode : ?VNode ) : ?VNode {
27+ const compOptions = vnode && vnode . componentOptions
28+ if ( compOptions && compOptions . Ctor . options . abstract ) {
29+ return getRealChild ( getFirstComponentChild ( compOptions . children ) )
30+ } else {
31+ return vnode
32+ }
33+ }
34+
2435export function extractTransitionData ( comp : Component ) : Object {
2536 const data = { }
2637 const options = comp . $options
@@ -86,8 +97,13 @@ export default {
8697 // use getRealChild() to ignore abstract components e.g. keep-alive
8798 const child = getRealChild ( rawChild )
8899 /* istanbul ignore if */
89- if ( ! child ) return
90- child . key = child . key || `__v${ child . tag + this . _uid } __`
100+ if ( ! child ) {
101+ return rawChild
102+ }
103+
104+ child . key = child . key == null
105+ ? `__v${ child . tag + this . _uid } __`
106+ : child . key
91107 const data = ( child . data || ( child . data = { } ) ) . transition = extractTransitionData ( this )
92108 const oldRawChild = this . _vnode
93109 const oldChild : any = getRealChild ( oldRawChild )
0 commit comments