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 data-trunk rel="copy-file" href="static/login.css" />
|
||||
</head>
|
||||
<body></body>
|
||||
<body>
|
||||
<main></main>
|
||||
<script src="/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ enum Route {
|
|||
fn App() -> Html {
|
||||
html! {
|
||||
<BrowserRouter>
|
||||
<main>
|
||||
<Switch<Route> render={switch} />
|
||||
</main>
|
||||
</BrowserRouter>
|
||||
}
|
||||
}
|
||||
|
|
@ -151,5 +149,13 @@ fn Login() -> Html {
|
|||
fn main() {
|
||||
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