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