You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying out components with slots and something weird is happening.
My component is a bootstrap modal, I made it work by passing the boolean prop showEditStateModal which shows or hides the modal. It has a header, body (default) and a footer slot.
The problem is, the first time I open the modal after the page load, it correctly copies the slot div to the right place, but also copies it to the default slot (body).
The dom looks like this:
After I close the modal, it correctly copies the element to the footer only. It's only the first time that I open the model that the problem happens.
Also, theres another problem, since I'm not giving any content besides the footer slot, the default slot (body), that is in the component's template, should be printed. So I should see "xyz" in the body, but it's empty.
I found the culprit to be the v-if="show". Without it, it works as expected.
For the second "problem", I've read the documentation again and it doesn't say that we can mix a "fallback" slot with named slots. I assumed that it would let me do that, but I was wrong.
I kind of understand why it has that behavior, so maybe it's working as intended.
Also, as I said, in the docs it doesn't say that we can do that, so I guess we can't.
I'm trying out components with slots and something weird is happening.
My component is a bootstrap modal, I made it work by passing the boolean prop showEditStateModal which shows or hides the modal. It has a header, body (default) and a footer slot.
The problem is, the first time I open the modal after the page load, it correctly copies the slot div to the right place, but also copies it to the default slot (body).
The dom looks like this:
After I close the modal, it correctly copies the element to the footer only. It's only the first time that I open the model that the problem happens.
Also, theres another problem, since I'm not giving any content besides the footer slot, the default slot (body), that is in the component's template, should be printed. So I should see "xyz" in the body, but it's empty.
Here are my templates:
Parent:
Component:
The text was updated successfully, but these errors were encountered: