import Vue from 'vue';
export default function $v2d({
vdom,
component,
data,
}) {
const Instance = Vue.extend(vdom ? {
render() { return vdom }
} : component);
const vm = new Instance({
data() { return { ...data } },
}).$mount();
document.body.appendChild(vm.$el);
return vm;
}
渲染 VDOM
computed: {
vnode() {
return (
<div>
{ this.name }
</div>
)
}
},
mounted() {
this.v2d
}