Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to reset layout in sveltekit?

$
0
0

How can I reset layout inheritance in Svelte?

Parent

I have a parent layout at src/routes/+layout.svelte:

<script>  import Header from "$lib/components/Header.svelte";</script><Header/><slot/>

Home page result

enter image description here


Child

In a child route, src/routes/(admin)/+layout@.svelte, I want to reset the layout inheritance. This +layout@.svelte supposed to work, but for some reason it doesn't. The header component from the parent layout still persists in dashboard page. Currently, my +layout@.svelte looks like this:

<slot/>

Dashboad page result

enter image description here

However, the header from src/routes/+layout.svelte still appears. How can I properly reset the layout inheritance so that the child layout does not include the parent header?

Folder structure

routes/├── (admin)/│└── dashboard/│   |       ├──+page.svelte│└──+layout@.svelte├── styles.css├──+layout.svelte├──+page.svelte├──+page.ts└── app.html

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>