Hey!
With our current project, me and the team was wondering what was the reasoning behind the decision to not support slots in layouts?
We ran into it when we realized that a CSS grid layout would work best for our responsive view, since each page knows what kind of sidebar or extra content is required in this specific case. For that the structure would need to be like this:
head
...
body
my-header
nuxt
#content
slot
#sidebar
slot(name="sidebar")
#extra
slot(name="extra")
my-footer
Right now the two options we see are using a separate layout component or somehow coordinating sidebar and extra components to make their own requests according to current route, but both feel at odds with overall simplicity Nuxt aims for.
Why not Dynamic Components?
https://vuejs.org/v2/guide/components.html#Dynamic-Components
@awronski Dynamic Components are cool, but they're also very much over-engineering for current use-case. We just want to compose content and only a few of our pages have a separate component in the sidebar slot.
Hi,
The <nuxt> component includes a <router-view> tag so that's why we cannot use slots.
Nested routes can be a solution in your case.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@awronski Dynamic Components are cool, but they're also very much over-engineering for current use-case. We just want to compose content and only a few of our pages have a separate component in the sidebar slot.