make sure to expose real instance instead of proxy as vnode.context

This commit is contained in:
Evan You 2016-05-26 12:57:45 -04:00
parent 2114cca184
commit 69abe1b726
3 changed files with 5 additions and 1 deletions

View File

@ -45,6 +45,7 @@ declare interface Component {
// private properties
_uid: number;
_isVue: true;
_self: Component;
_renderProxy: Component;
_watcher: Watcher;
_watchers: Array<Watcher>;

View File

@ -34,6 +34,8 @@ export function initMixin (Vue: Class<Component>) {
} else {
vm._renderProxy = vm
}
// expose real self
vm._self = vm
initLifecycle(vm)
initEvents(vm)
callHook(vm, 'init')

View File

@ -34,7 +34,8 @@ export function renderElement (
data?: VNodeData,
namespace?: string
): VNode | void {
const context: Component = this
// make sure to expose real self instead of proxy
const context: Component = this._self
const parent: Component | null = renderState.activeInstance
if (!parent) {
process.env.NODE_ENV !== 'production' && warn(