Fix router examples

This commit is contained in:
Jonathan Kelley committed 2024-01-17 18:41:31 -08:00
1 parent 5291b00798
commit 1df329bda4
6 files changed
+35 -15

No files matched your search

Generated
-1
View File
@@ -2571,7 +2571,6 @@ dependencies = [
"env_logger",
"futures-util",
"http-range",
"im-rc",
"log",
"manganis",
"num-format",
-1
View File
@@ -136,7 +136,6 @@ log = "0.4.14"
num-format = "0.4.0"
separator = "0.4.1"
serde = { version = "1.0.136", features = ["derive"] }
im-rc = "15.0.0"
anyhow = "1.0.53"
serde_json = "1.0.79"
rand = { version = "0.8.4", features = ["small_rng"] }
+13 -9
View File
@@ -5,15 +5,19 @@ use dioxus_router::prelude::*;
fn main() {
env_logger::init();
LaunchBuilder::new(Route::Home {})
.cfg(
Config::new().with_window(
WindowBuilder::new()
.with_inner_size(LogicalSize::new(600, 1000))
.with_resizable(false),
),
)
.launch_desktop()
LaunchBuilder::new(|| {
rsx! {
Router::<Route> {}
}
})
.cfg(
Config::new().with_window(
WindowBuilder::new()
.with_inner_size(LogicalSize::new(600, 1000))
.with_resizable(false),
),
)
.launch_desktop()
}
#[derive(Routable, Clone)]
+5 -1
View File
@@ -2,7 +2,11 @@ use dioxus::prelude::*;
use dioxus_router::prelude::*;
fn main() {
launch_desktop(Route::Home {});
launch_desktop(|| {
rsx! {
Router::<Route> {}
}
});
}
#[derive(Routable, Clone, Debug, PartialEq)]
+5 -1
View File
@@ -9,7 +9,11 @@ fn main() {
.with_module_level("dioxus", log::LevelFilter::Trace)
.init()
.unwrap();
launch_desktop(Route::Home {});
launch_desktop(|| {
rsx! {
Router::<Route> {}
}
});
}
#[derive(Routable, Clone)]
+12 -2
View File
@@ -54,7 +54,17 @@ fn Nav() -> Element {
}
fn main() {
launch_desktop(Route::Blog {
id: "hello".to_string(),
launch_desktop(|| {
let cfg = || {
RouterConfig::default().initial_route(Route::Blog {
id: "hello".to_string(),
})
};
rsx! {
Router::<Route> {
config: cfg
}
}
});
}