app: Render to main to add scripts to the entire application
This commit is contained in:
parent
db8cb0efff
commit
12fc86492d
2 changed files with 14 additions and 5 deletions
|
|
@ -6,5 +6,8 @@
|
||||||
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
||||||
<link data-trunk rel="copy-file" href="static/login.css" />
|
<link data-trunk rel="copy-file" href="static/login.css" />
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body>
|
||||||
|
<main></main>
|
||||||
|
<script src="/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@ enum Route {
|
||||||
fn App() -> Html {
|
fn App() -> Html {
|
||||||
html! {
|
html! {
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<main>
|
<Switch<Route> render={switch} />
|
||||||
<Switch<Route> render={switch} />
|
|
||||||
</main>
|
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -151,5 +149,13 @@ fn Login() -> Html {
|
||||||
fn main() {
|
fn main() {
|
||||||
console_log::init_with_level(Level::Debug).unwrap();
|
console_log::init_with_level(Level::Debug).unwrap();
|
||||||
|
|
||||||
yew::Renderer::<App>::new().render();
|
yew::Renderer::<App>::with_root(
|
||||||
|
gloo_utils::document()
|
||||||
|
.body()
|
||||||
|
.expect("no body")
|
||||||
|
.get_elements_by_tag_name("main")
|
||||||
|
.item(0)
|
||||||
|
.expect("no main"),
|
||||||
|
)
|
||||||
|
.render();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue