I'm currently working on an app where I need to attach a Vue
instance to an HTML Node
. However, I am facing an issue after using the $mount
function as the Node
does not seem to contain the Vue
instance.
The code snippet below showcases my goal. I aim to produce an HTML Node
that holds the Vue
instance within it.
const el = document.createElement('div');
new Vue({
render(createElement) {
return createElement(HelloWorldVue, {}, {});
},
components: {
HelloWorldVue,
},
}).$mount(el);
return el;
If anyone has any insights or suggestions on how to properly mount the Vue instance to the element before displaying it, please share them with me. Thank you!