While working on Vue.js (single file components), I have discovered three methods of passing data around: local state/props, store, and utilizing PortalVue. Through my experiments with PortalVue, I successfully implemented both portal and portal-target within the same .vue file. However, attempts to use portal and portal-target across two separate .vue files were unsuccessful.
The PortalVue documentation explains that "PortalVue is a set of two components that allow you to render a component's template (or a part of it) anywhere in the document - even outside the part controlled by your Vue App!"
Does this mean PortalVue only functions when both portal components are in the same file?
It works within one component
Example in ComponentA.vue:
<portal to="destination">
<p>Send this to destination</p>
</portal>
<portal-target name="destination"gt;
</portal-target>
However, the following does not render
Example in ComponentB.vue:
<portal to="destination">
<p>Send this to destination</p>
</portal>
<portal-target name="destination">
</portal-target>