enabled the liveview history by default if the liveview feature is enabled in the router
This commit is contained in:
1 parent
cd019db9ef
commit
3feee729bc
3 files changed
+65
-38
No files matched your search
@@ -54,10 +54,7 @@ fn main() {
|
||||
#[cfg(feature = "liveview")]
|
||||
#[component]
|
||||
fn Root(cx: Scope) -> Element {
|
||||
let history = LiveviewHistory::new(cx);
|
||||
render! { Router::<Route> {
|
||||
config: || RouterConfig::default().history(history),
|
||||
} }
|
||||
render! { Router::<Route> {} }
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "liveview"))]
|
||||
@@ -84,12 +81,19 @@ fn Route1(cx: Scope, user_id: usize, dynamic: usize, query: String, extra: Strin
|
||||
"Route1{{\n\tuser_id:{user_id},\n\tdynamic:{dynamic},\n\tquery:{query},\n\textra:{extra}\n}}"
|
||||
}
|
||||
Link {
|
||||
to: Route::Route1 { user_id: *user_id, dynamic: *dynamic, query: String::new(), extra: extra.clone() + "." },
|
||||
to: Route::Route1 {
|
||||
user_id: *user_id,
|
||||
dynamic: *dynamic,
|
||||
query: String::new(),
|
||||
extra: extra.clone() + ".",
|
||||
},
|
||||
"Route1 with extra+\".\""
|
||||
}
|
||||
p { "Footer" }
|
||||
Link {
|
||||
to: Route::Route3 { dynamic: String::new() },
|
||||
to: Route::Route3 {
|
||||
dynamic: String::new(),
|
||||
},
|
||||
"Home"
|
||||
}
|
||||
}
|
||||
@@ -98,13 +102,13 @@ fn Route1(cx: Scope, user_id: usize, dynamic: usize, query: String, extra: Strin
|
||||
#[component]
|
||||
fn Route2(cx: Scope, user_id: usize) -> Element {
|
||||
render! {
|
||||
pre {
|
||||
"Route2{{\n\tuser_id:{user_id}\n}}"
|
||||
}
|
||||
pre { "Route2{{\n\tuser_id:{user_id}\n}}" }
|
||||
(0..*user_id).map(|i| rsx!{ p { "{i}" } }),
|
||||
p { "Footer" }
|
||||
Link {
|
||||
to: Route::Route3 { dynamic: String::new() },
|
||||
to: Route::Route3 {
|
||||
dynamic: String::new(),
|
||||
},
|
||||
"Home"
|
||||
}
|
||||
}
|
||||
@@ -130,22 +134,25 @@ fn Route3(cx: Scope, dynamic: String) -> Element {
|
||||
value: "{current_route_str.read()}"
|
||||
}
|
||||
"dynamic: {dynamic}"
|
||||
Link {
|
||||
to: Route::Route2 { user_id: 8888 },
|
||||
"hello world link"
|
||||
}
|
||||
Link { to: Route::Route2 { user_id: 8888 }, "hello world link" }
|
||||
button {
|
||||
disabled: !navigator.can_go_back(),
|
||||
onclick: move |_| { navigator.go_back(); },
|
||||
onclick: move |_| {
|
||||
navigator.go_back();
|
||||
},
|
||||
"go back"
|
||||
}
|
||||
button {
|
||||
disabled: !navigator.can_go_forward(),
|
||||
onclick: move |_| { navigator.go_forward(); },
|
||||
onclick: move |_| {
|
||||
navigator.go_forward();
|
||||
},
|
||||
"go forward"
|
||||
}
|
||||
button {
|
||||
onclick: move |_| { navigator.push("https://www.google.com"); },
|
||||
onclick: move |_| {
|
||||
navigator.push("https://www.google.com");
|
||||
},
|
||||
"google link"
|
||||
}
|
||||
p { "Site Map" }
|
||||
|
||||
Reference in new issue
Block a user