Fix router examples
This commit is contained in:
6 files changed
+35
-15
No files matched your search
+13
-9
@@ -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
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user