|
|
@ -49,17 +49,18 @@ export function initRender (vm: Component) { |
|
|
|
// $attrs & $listeners are exposed for easier HOC creation.
|
|
|
|
// they need to be reactive so that HOCs using them are always updated
|
|
|
|
const parentData = parentVnode && parentVnode.data |
|
|
|
|
|
|
|
/* istanbul ignore else */ |
|
|
|
if (process.env.NODE_ENV !== 'production') { |
|
|
|
defineReactive(vm, '$attrs', parentData && parentData.attrs, () => { |
|
|
|
defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, () => { |
|
|
|
!isUpdatingChildComponent && warn(`$attrs is readonly.`, vm) |
|
|
|
}, true) |
|
|
|
defineReactive(vm, '$listeners', vm.$options._parentListeners, () => { |
|
|
|
defineReactive(vm, '$listeners', vm.$options._parentListeners || emptyObject, () => { |
|
|
|
!isUpdatingChildComponent && warn(`$listeners is readonly.`, vm) |
|
|
|
}, true) |
|
|
|
} else { |
|
|
|
defineReactive(vm, '$attrs', parentData && parentData.attrs, null, true) |
|
|
|
defineReactive(vm, '$listeners', vm.$options._parentListeners, null, true) |
|
|
|
defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true) |
|
|
|
defineReactive(vm, '$listeners', vm.$options._parentListeners || emptyObject, null, true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|