feat: update leptos to v0.7.0-beta2

This commit is contained in:
luoxiao 2024-08-15 22:34:43 +08:00 committed by luoxiaozero
parent d4093f6ca6
commit 1e17565114
4 changed files with 22 additions and 24 deletions

View file

@ -16,6 +16,6 @@ thaw_components = { version = "0.2.0-alpha", path = "./thaw_components" }
thaw_macro = { version = "0.1.0-alpha", path = "./thaw_macro" }
thaw_utils = { version = "0.1.0-alpha", path = "./thaw_utils" }
leptos = { git = "https://github.com/leptos-rs/leptos", rev = "20af4928b2fffe017408d3f4e7330db22cf68277" }
leptos_meta = { git = "https://github.com/leptos-rs/leptos", rev = "20af4928b2fffe017408d3f4e7330db22cf68277" }
leptos_router = { git = "https://github.com/leptos-rs/leptos", rev = "20af4928b2fffe017408d3f4e7330db22cf68277" }
leptos = { version = "0.7.0-beta2" }
leptos_meta = { version = "0.7.0-beta2" }
leptos_router = { version = "0.7.0-beta2" }

View file

@ -74,7 +74,7 @@ fn TheRouter() -> impl IntoView {
<Route path=path!("/config-provider") view=ConfigProviderMdPage/>
</ParentRoute>
<ParentRoute path=path!("/components") view=ComponentsPage>
<Route path=path!("date-picker") view=DatePickerMdPage/>
<Route path=path!("/date-picker") view=DatePickerMdPage/>
<Route path=path!("/dialog") view=DialogMdPage/>
<Route path=path!("/divider") view=DividerMdPage/>
<Route path=path!("/drawer") view=DrawerMdPage/>

View file

@ -13,25 +13,23 @@ pub fn SwitchVersion() -> impl IntoView {
("0.2.5", "https://thaw-8og1kv8zs-thaw.vercel.app"),
];
cfg_if::cfg_if! {
if #[cfg(any(feature = "csr", feature = "hydrate"))] {
let location = window().location();
let origin = location.origin().ok();
let version = RwSignal::new(origin);
let _ = version.watch(move |origin| {
if let Some(origin) = origin {
let pathname = location.pathname().unwrap_or_default();
let href = format!("{}{}", origin, pathname);
let _ = location.set_href(&href);
}
});
} else {
// let version = RwSignal::new(None::<String>);
}
let version = RwSignal::new(None::<String>);
#[cfg(any(feature = "csr", feature = "hydrate"))]
{
let location = window().location();
let origin = location.origin().ok();
version.set(origin);
let _ = version.watch(move |origin| {
if let Some(origin) = origin {
let pathname = location.pathname().unwrap_or_default();
let href = format!("{}{}", origin, pathname);
let _ = location.set_href(&href);
}
});
}
view! {
<Combobox>
<Combobox selected_options=version placeholder="Switch version">
{
options.into_iter().map(|option| view! {
<ComboboxOption value=option.1 text=option.0 />

View file

@ -9,10 +9,10 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
axum = { version = "0.7.5", optional = true }
console_error_panic_hook = "0.1"
leptos = { git = "https://github.com/leptos-rs/leptos", rev = "20af4928b2fffe017408d3f4e7330db22cf68277" }
leptos_axum = { git = "https://github.com/leptos-rs/leptos", rev = "20af4928b2fffe017408d3f4e7330db22cf68277", optional = true }
leptos_meta = { git = "https://github.com/leptos-rs/leptos", rev = "20af4928b2fffe017408d3f4e7330db22cf68277" }
leptos_router = { git = "https://github.com/leptos-rs/leptos", rev = "20af4928b2fffe017408d3f4e7330db22cf68277" }
leptos = { version = "0.7.0-beta2" }
leptos_axum = { version = "0.7.0-beta2", optional = true }
leptos_meta = { version = "0.7.0-beta2" }
leptos_router = { version = "0.7.0-beta2" }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
tower = { version = "0.5.0", optional = true }
tower-http = { version = "0.5", features = ["fs"], optional = true }