|
|
@ -17,9 +17,10 @@ import { isUpdatingChildComponent } from './lifecycle' |
|
|
|
|
|
|
|
export function initRender (vm: Component) { |
|
|
|
vm._vnode = null // the root of the child tree
|
|
|
|
const parentVnode = vm.$vnode = vm.$options._parentVnode // the placeholder node in parent tree
|
|
|
|
const options = vm.$options |
|
|
|
const parentVnode = vm.$vnode = options._parentVnode // the placeholder node in parent tree
|
|
|
|
const renderContext = parentVnode && parentVnode.context |
|
|
|
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext) |
|
|
|
vm.$slots = resolveSlots(options._renderChildren, renderContext) |
|
|
|
vm.$scopedSlots = emptyObject |
|
|
|
// bind the createElement fn to this instance
|
|
|
|
// so that we get proper render context inside it.
|
|
|
@ -39,12 +40,12 @@ export function initRender (vm: Component) { |
|
|
|
defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, () => { |
|
|
|
!isUpdatingChildComponent && warn(`$attrs is readonly.`, vm) |
|
|
|
}, true) |
|
|
|
defineReactive(vm, '$listeners', vm.$options._parentListeners || emptyObject, () => { |
|
|
|
defineReactive(vm, '$listeners', options._parentListeners || emptyObject, () => { |
|
|
|
!isUpdatingChildComponent && warn(`$listeners is readonly.`, vm) |
|
|
|
}, true) |
|
|
|
} else { |
|
|
|
defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true) |
|
|
|
defineReactive(vm, '$listeners', vm.$options._parentListeners || emptyObject, null, true) |
|
|
|
defineReactive(vm, '$listeners', options._parentListeners || emptyObject, null, true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|