flat_router.rs 1001 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. use dioxus::prelude::*;
  2. use dioxus_desktop::tao::dpi::LogicalSize;
  3. use dioxus_router::{Link, Route, Router};
  4. fn main() {
  5. env_logger::init();
  6. dioxus_desktop::launch_cfg(app, |c| {
  7. c.with_window(|c| {
  8. c.with_title("Spinsense Client")
  9. .with_inner_size(LogicalSize::new(600, 1000))
  10. .with_resizable(false)
  11. })
  12. })
  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. }