Closed seb-odoo closed 2 years ago
I checked the Vue documentation and they are very clear that the content inside a slot does not have access to the parent scope.
I am also not in favor of such a change:
Popover
component can simply set a is-opened
class on itself, and the content can use this to style itself. This is what you would do in Vue as well.I suggest to wait for a stronger usecase, and then we will decide what the best way to move forward is
Please read the Scoped Slots paragraph on the same page, it is exactly the answer to the current use case: https://vuejs.org/v2/guide/components-slots.html#Scoped-Slots
ooh, i didn't see it at first! This also looks like a good API
I didn't know either, I just found it. I'm glad to see it's pretty much what I suggested except instead of a magic key, we can explicitly define it, which is even better. So if we go with that I would consider the issue resolved of course.
done in owl 2
The use case in Odoo: the
Popover
component and especially itsdisplayed
state.The element on which the popover is bound (which is defined as a slot) can have a different style depending on whether the popover is open or not.
This information is only known by the popover component itself, not by the parent calling it, and I would like to have a way to access this information from the slot's element that is defined in the parent, but due to the slot mechanisms, it only has access to the parent context.
I would suggest to add a special key on that context to still be able to access the real/intermediary rendering context.