|
|
@ -16,7 +16,7 @@ import { |
|
|
|
} from '../vdom/create-element' |
|
|
|
|
|
|
|
export const renderState: { |
|
|
|
activeInstance: Component | null |
|
|
|
activeInstance: ?Component |
|
|
|
} = { |
|
|
|
activeInstance: null |
|
|
|
} |
|
|
@ -35,6 +35,19 @@ export function initRender (vm: Component) { |
|
|
|
) { |
|
|
|
return this._h(this._e(tag, data, namespace), children) |
|
|
|
}, vm) |
|
|
|
// for abstract components, determine first non-abstract parent
|
|
|
|
// so that the children of abstract components are considered children
|
|
|
|
// of the first non-abstract parent.
|
|
|
|
// this is used by internal abstract components like <keep-alive>.
|
|
|
|
if (vm.$options._abstract) { |
|
|
|
let parent = vm.$parent |
|
|
|
while (parent && parent.$options._abstract) { |
|
|
|
parent = parent.$parent |
|
|
|
} |
|
|
|
vm._renderParent = parent |
|
|
|
} else { |
|
|
|
vm._renderParent = vm |
|
|
|
} |
|
|
|
if (vm.$options.el) { |
|
|
|
vm.$mount(vm.$options.el) |
|
|
|
} |
|
|
@ -48,7 +61,7 @@ export function renderMixin (Vue: Class<Component>) { |
|
|
|
Vue.prototype._render = function (): VNode { |
|
|
|
const vm: Component = this |
|
|
|
const prev = renderState.activeInstance |
|
|
|
renderState.activeInstance = vm |
|
|
|
renderState.activeInstance = vm._renderParent |
|
|
|
if (!vm._isMounted) { |
|
|
|
// render static sub-trees for once on initial render
|
|
|
|
renderStaticTrees(vm) |
|
|
|