Module silkenweb::router

source ·
Expand description

URL based routing.

Get the URL path with url_path, and set it with set_url_path or a link to a fragment like <a href="#anchor" ...>.

§Example

div()
    .child(
        button()
            .on_click(|_, _| router::set_url_path("route_1"))
            .text("Go to route 1"),
    )
    .child(
        button()
            .on_click(|_, _| router::set_url_path("route_2"))
            .text("Go to route 2"),
    )
    .child(p().text(Sig(
        router::url_path().signal_ref(|url_path| format!("URL Path is: {url_path}")),
    )));

Structs§

  • Represent the path portion of a URL (including any query string)

Functions§