fix: tests pass
This commit is contained in:
1 parent
06d4a5640b
commit
c7627f0b93
10 files changed
+33
-18
No files matched your search
@@ -11,7 +11,7 @@ use dioxus_html as dioxus_elements;
|
||||
pub struct LinkProps<'a> {
|
||||
/// The route to link to. This can be a relative path, or a full URL.
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// // Absolute path
|
||||
/// Link { to: "/home", "Go Home" }
|
||||
///
|
||||
@@ -64,7 +64,7 @@ pub struct LinkProps<'a> {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// fn Header(cx: Scope) -> Element {
|
||||
/// cx.render(rsx!{
|
||||
/// Link { to: "/home", "Go Home" }
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::use_router;
|
||||
pub struct RedirectProps<'a> {
|
||||
/// The route to link to. This can be a relative path, or a full URL.
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// // Absolute path
|
||||
/// Redirect { from: "", to: "/home" }
|
||||
///
|
||||
@@ -20,7 +20,7 @@ pub struct RedirectProps<'a> {
|
||||
|
||||
/// The route to link from. This can be a relative path, or a full URL.
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// // Absolute path
|
||||
/// Redirect { from: "", to: "/home" }
|
||||
///
|
||||
|
||||
@@ -22,7 +22,7 @@ pub struct RouteProps<'a> {
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
///```rust
|
||||
///```rust, ignore
|
||||
/// rsx!(
|
||||
/// Router {
|
||||
/// Route { to: "/home", Home {} }
|
||||
|
||||
@@ -48,7 +48,16 @@ impl UseRoute {
|
||||
/// Get the first query parameter given the parameter name.
|
||||
///
|
||||
/// If you need to get more than one parameter, use [`query_pairs`] on the [`Url`] instead.
|
||||
pub fn query(&self, param: &str) -> Option<Cow<str>> {
|
||||
#[cfg(feature = "query")]
|
||||
pub fn query<T: serde::de::DeserializeOwned>(&self) -> Option<T> {
|
||||
let query = self.url().query()?;
|
||||
serde_urlencoded::from_str(query.strip_prefix('?').unwrap_or("")).ok()
|
||||
}
|
||||
|
||||
/// Get the first query parameter given the parameter name.
|
||||
///
|
||||
/// If you need to get more than one parameter, use [`query_pairs`] on the [`Url`] instead.
|
||||
pub fn query_param(&self, param: &str) -> Option<Cow<str>> {
|
||||
self.route
|
||||
.url
|
||||
.query_pairs()
|
||||
|
||||
@@ -8,7 +8,7 @@ pub struct RouteContext {
|
||||
///
|
||||
///
|
||||
/// It follows this pattern:
|
||||
/// ```
|
||||
/// ```ignore
|
||||
/// "name/:id"
|
||||
/// ```
|
||||
pub declared_route: String,
|
||||
@@ -17,7 +17,7 @@ pub struct RouteContext {
|
||||
///
|
||||
///
|
||||
/// It follows this pattern:
|
||||
/// ```
|
||||
/// ```ignore
|
||||
/// "/level0/level1/:id"
|
||||
/// ```
|
||||
pub total_route: String,
|
||||
|
||||
@@ -29,7 +29,7 @@ use url::Url;
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// let router = Router::new();
|
||||
/// router.push_route("/home/custom");
|
||||
/// cx.provide_context(router);
|
||||
@@ -280,6 +280,8 @@ mod hash {
|
||||
serialized_state: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn replace(&self, _route: &ParsedRoute) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user