How do I use default layouts when using SSR? #1236
-
I have created a fresh Laravel Jetstream application and wanted to make a default layout. However following the guide does not work. My suspicion is: it's either outdated or SSR requires a different method. Using So I tried: // import DefaultLayout from './Layouts/AppLayout.vue'
resolve: (name) => {
const page = resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')) // adding .default didn't work
page.layout = page.layout || DefaultLayout
return page
}, This doesn't return an error but the layout does not appear. Am I missing something or is it a bug? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I've reached out to the devs on Discords and @RobertBoes helped me resolve this problem. He explained From there we can set the default layout. resolve: async (name) => {
const page = (await resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue'))).default
page.layout = page.layout || DefaultLayout
return page
}, This solved my issue. The default layout is showing up and is persistent. |
Beta Was this translation helpful? Give feedback.
I've reached out to the devs on Discords and @RobertBoes helped me resolve this problem.
He explained
resolvePageComponent
(orimportPageComponent
) returns a promise so we should await this method to obtain the default export.From there we can set the default layout.
This solved my issue. The default layout is showing up and is persistent.