Using Teleport via Application API - app.teleport(...)
What problem does this feature solve?
In writing vue plugin, sometime it needs an extra vue component mounted on the page.
In the current situation, app.component(...)
can only register the vue component but not to create it in vue plugin.
We can just const widget = createApp(...)
and widget.mount('#myDiv')
to mount it in the page as a separate Vue Application.
I think there shall be a better way as <Teleport>
is already introduced in Vue3.
What does the proposed API look like?
This new application API shall look like app.teleport(myComp, {to: '#myDiv'})
This should be equivalent to <teleport to="#myDiv"><myComp></myComp></teleport>
in SFC, but in the install(app, config){...}
of vue plugin