refactor: return Proxy from base class constructor

This commit is contained in:
Evan You
2019-03-05 16:24:07 -05:00
parent c335939dcf
commit ec0ccd2337
9 changed files with 62 additions and 56 deletions

View File

@@ -17,7 +17,7 @@ class Vue {
// convert it to a class
const Component = createComponentClassFromOptions(options || {})
const vnode = h(Component)
const instance = createComponentInstance(vnode)
const instance = (vnode.children = createComponentInstance(vnode))
function mount(el: any) {
const dom = typeof el === 'string' ? document.querySelector(el) : el
@@ -26,10 +26,10 @@ class Vue {
}
if (options.el) {
return mount(options.el)
return mount(options.el) as any
} else {
;(instance as any).$mount = mount
return instance.$proxy
return instance.$proxy as any
}
}
}