flat_router.rs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. use dioxus::prelude::*;
  2. use dioxus_desktop::{tao::dpi::LogicalSize, Config, WindowBuilder};
  3. use dioxus_router::{Link, Route, Router};
  4. fn main() {
  5. env_logger::init();
  6. let cfg = Config::new().with_window(
  7. WindowBuilder::new()
  8. .with_title("Spinsense Client")
  9. .with_inner_size(LogicalSize::new(600, 1000))
  10. .with_resizable(false),
  11. );
  12. dioxus_desktop::launch_cfg(app, cfg)
  13. }
  14. fn app(cx: Scope) -> Element {
  15. cx.render(rsx! {
  16. Router {
  17. Route { to: "/", "Home" }
  18. Route { to: "/games", "Games" }
  19. Route { to: "/play", "Play" }
  20. Route { to: "/settings", "Settings" }
  21. p {
  22. "----"
  23. }
  24. nav {
  25. ul {
  26. Link { to: "/", li { "Home" } }
  27. Link { to: "/games", li { "Games" } }
  28. Link { to: "/play", li { "Play" } }
  29. Link { to: "/settings", li { "Settings" } }
  30. }
  31. }
  32. }
  33. })
  34. }