50 lines
1.1 KiB
Svelte
50 lines
1.1 KiB
Svelte
<script lang="ts">
|
|
import { _ } from "svelte-i18n"
|
|
import { Router, Route } from "svelte-routing"
|
|
import { scrollToTop } from "svelte-scrollto"
|
|
import { location } from "../store"
|
|
|
|
import Home from "./routes/Home.svelte"
|
|
import Content from "./routes/Content.svelte"
|
|
|
|
import Header from "./widgets/Header.svelte"
|
|
import Footer from "./widgets/Footer.svelte"
|
|
|
|
export let url = ""
|
|
|
|
if (url) {
|
|
// ssr
|
|
let l = url.split("?")
|
|
$location = {
|
|
path: l[0],
|
|
search: l.length > 1 ? l[1] : "",
|
|
push: false,
|
|
pop: false,
|
|
}
|
|
}
|
|
|
|
// scroll to top on new site
|
|
location.subscribe((location) => {
|
|
if (location.push) scrollToTop()
|
|
})
|
|
|
|
if (typeof window !== "undefined") console.log("App initialized")
|
|
</script>
|
|
|
|
<Header />
|
|
|
|
<Router url="{url}">
|
|
<Route path="/" let:params>
|
|
<Home />
|
|
</Route>
|
|
<Route path="/*path" let:params>
|
|
<Content path="{params.path}" />
|
|
</Route>
|
|
</Router>
|
|
|
|
<Footer />
|
|
|
|
<style lang="less" global>
|
|
@import "./../css/main.less";
|
|
</style>
|