A feature-rich Portal Plugin for Vue 3, for rendering DOM outside of a component, anywhere in your app or the entire document. (Vue 2 version: v2.portal-vue.linusb.org)
My use case is pretty simple, I have a sidebar on every page, that is naturally outside of the router view.
I want this sidebar to be partially populated by the page. The simplest way to do that is for the sidebar to define a <portal-target name="sidebar"> and every page to define a <portal to="sidebar">
However, I want to pass the current state of the sidebar (minified or not) to whatever is currently populating the sidebar.
Hi, and thanks for your work.
My use case is pretty simple, I have a sidebar on every page, that is naturally outside of the router view.
I want this sidebar to be partially populated by the page. The simplest way to do that is for the sidebar to define a
<portal-target name="sidebar">
and every page to define a<portal to="sidebar">
However, I want to pass the current state of the sidebar (minified or not) to whatever is currently populating the sidebar.
This could be done pretty easily, like this
sidebar.vue
page.vue
This would simply require to deconstruct the
$props
object received by<portal-target>
, and to pass it to<portal>
as scoped slot parameters.