[improvement] Overlay: functional & tsx (#2822)

This commit is contained in:
neverland
2019-02-22 09:27:00 +08:00
committed by GitHub
parent ea36edbd1a
commit 91a9345a7d
4 changed files with 68 additions and 42 deletions

View File

@@ -58,12 +58,15 @@ export function emit(context: Context, eventName: string, ...args: any[]) {
}
// mount functional component
export function mount(Component: any) {
export function mount(Component: any, data?: VNodeData) {
const instance = new Vue({
el: document.createElement('div'),
props: Component.props,
render(h) {
return h(Component, { props: this.$props });
return h(Component, {
props: this.$props,
...data
});
}
});