use body as target
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Svelte-Tauri</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<body id="app">
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { theme } from '$lib/stores/theme';
|
||||
import Router from '$lib/router/Router.svelte';
|
||||
import BaseLayout from '$lib/layout/BaseLayout.svelte';
|
||||
|
||||
$: {
|
||||
document.documentElement.setAttribute('data-theme', $theme);
|
||||
document.documentElement.classList.value = $theme;
|
||||
}
|
||||
import Router from '$router/Router.svelte'
|
||||
import { ModeWatcher, mode } from 'mode-watcher'
|
||||
import Header from '$lib/components/HeaderNav.svelte'
|
||||
import { Toaster } from 'svelte-sonner'
|
||||
</script>
|
||||
|
||||
<BaseLayout>
|
||||
<ModeWatcher defaultMode="dark" />
|
||||
<Toaster theme={$mode} />
|
||||
|
||||
<div class="relative flex flex-col h-screen" data-vaul-drawer-wrapper id="page">
|
||||
<Header />
|
||||
<main class="flex-1">
|
||||
<Router />
|
||||
</BaseLayout>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
17
src/main.ts
17
src/main.ts
@@ -1,15 +1,16 @@
|
||||
import './styles.pcss';
|
||||
import App from './App.svelte';
|
||||
import './styles.postcss'
|
||||
import App from './App.svelte'
|
||||
|
||||
const target = document.getElementById('app');
|
||||
if (!target)
|
||||
const target = document.getElementById('app')
|
||||
if (!target) {
|
||||
throw new Error(
|
||||
"The element with id of 'app' wasn't found on the base html file."
|
||||
);
|
||||
"The element with id of 'app' was not found on the base html file. Create that element and try again"
|
||||
)
|
||||
}
|
||||
|
||||
const app = new App({
|
||||
target,
|
||||
intro: true
|
||||
});
|
||||
})
|
||||
|
||||
export default app;
|
||||
export default app
|
||||
|
||||
Reference in New Issue
Block a user