portal-vue
portal-vue copied to clipboard
allow to wrap portal-target content
I wondering if it is possible to wrap portal-target content ?
example:
<portal to="destination">
My content
</portal>
<div>
<portal-target name="destination">
<h1><slot name="default"></slot></h1>
</portal-target>
</div>
result:
if portal source is defined:
<div><h1>My content</h1></div>
if portal source is not defined:
<div></div>
Interesting idea! I don't have an immediate idea how to make it work, but we can think about it :)
I currently don't see an elegant way to make this possible, and don't want to add too much complexity to this lib any more - it has enogub options as it is, pretty much
I was just wondering if recent portal-view changes could make this feature easier to implement ?
I might have an idea, involving a scoped slot and some trickery with a dynamic component passed as the slot prop ... Not elegant but maybe makes it work.
<div>
<portal-target name="destination">
<template v-slot:wrapper="{ content }">
<h1><span :is="content"></span></h1>
<template>
</portal-target>
</div>
Just a spontaneous idea, I'll try it out and report back. Ping me once in a while to keep it from fading into the background again.
Interesting idea! thanks.
i would realy love to use this feature in order to have a seperator between multiple contents
explained: you have a <portal-target multiple>
tag, and between each element, i would like to have a line or some kind of separator.