implement scroll restoration

This commit is contained in:
Adrian Wannenmacher committed 2022-12-15 20:09:53 +01:00
1 parent 9912c32ffd
commit 10c2abf0d8
7 files changed
+261 -75

No files matched your search

+11 -3
View File
@@ -1,7 +1,7 @@
#![allow(non_snake_case)]
use dioxus::prelude::*;
use dioxus_router::prelude::*;
use dioxus_router::{history::MemoryHistory, prelude::*};
fn main() {
#[cfg(not(feature = "web"))]
@@ -13,8 +13,16 @@ fn main() {
fn App(cx: Scope) -> Element {
use_router(
&cx,
&|| RouterConfiguration {
..Default::default()
&|| {
#[cfg(not(feature = "web"))]
let history = MemoryHistory::default();
#[cfg(feature = "web")]
let history = dioxus_router::history::WebHistory::new(None, true);
RouterConfiguration {
history: Box::new(history),
..Default::default()
}
},
&|| {
Segment::content(comp(Home))