Svelte基础
Svelte高阶
上下文API
特殊元素
接下来
SvelteKit基础
Shared modules
API routes
$app/state
Errors and redirects
Advanced SvelteKit
Page options
Link options
Advanced routing
Advanced loading
Environment variables
Conclusion
Ordinarily, SvelteKit will navigate between pages without refreshing the page. In this exercise, if we navigate between /
and /about
, the timer keeps on ticking.
In rare cases, you might want to disable this behaviour. You can do so by adding the data-sveltekit-reload
attribute on an individual link, or any element that contains links:
src/routes/+layout
<nav data-sveltekit-reload>
<a href="/">home</a>
<a href="/about">about</a>
</nav>
For more information on available link options and their values, consult the link options documentation.
previous next
1
2
3
<h1>home</h1>
<p>this is the home page.</p>