Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to wrap portal-target content #132

Open
FranckFreiburger opened this issue Jun 15, 2018 · 6 comments
Open

allow to wrap portal-target content #132

FranckFreiburger opened this issue Jun 15, 2018 · 6 comments

Comments

@FranckFreiburger
Copy link

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>

@LinusBorg
Copy link
Owner

Interesting idea! I don't have an immediate idea how to make it work, but we can think about it :)

@LinusBorg
Copy link
Owner

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

@FranckFreiburger
Copy link
Author

I was just wondering if recent portal-view changes could make this feature easier to implement ?

@LinusBorg
Copy link
Owner

LinusBorg commented May 28, 2019

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.

@FranckFreiburger
Copy link
Author

Interesting idea! thanks.

@LinusBorg LinusBorg reopened this May 28, 2019
@mithom
Copy link

mithom commented Jun 13, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants