mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
feat: add create_query_signal_with_options
to leptos_router
(#2517)
This commit is contained in:
parent
9a7dbd50eb
commit
c1ebaf9d04
1 changed files with 12 additions and 1 deletions
|
@ -47,6 +47,17 @@ use std::{rc::Rc, str::FromStr};
|
|||
pub fn create_query_signal<T>(
|
||||
key: impl Into<Oco<'static, str>>,
|
||||
) -> (Memo<Option<T>>, SignalSetter<Option<T>>)
|
||||
where
|
||||
T: FromStr + ToString + PartialEq,
|
||||
{
|
||||
create_query_signal_with_options::<T>(key, NavigateOptions::default())
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn create_query_signal_with_options<T>(
|
||||
key: impl Into<Oco<'static, str>>,
|
||||
nav_options: NavigateOptions,
|
||||
) -> (Memo<Option<T>>, SignalSetter<Option<T>>)
|
||||
where
|
||||
T: FromStr + ToString + PartialEq,
|
||||
{
|
||||
|
@ -77,7 +88,7 @@ where
|
|||
let path = location.pathname.get_untracked();
|
||||
let hash = location.hash.get_untracked();
|
||||
let new_url = format!("{path}{qs}{hash}");
|
||||
navigate(&new_url, NavigateOptions::default());
|
||||
navigate(&new_url, nav_options.clone());
|
||||
});
|
||||
|
||||
(get, set)
|
||||
|
|
Loading…
Reference in a new issue