From dc58a03a8b684427ca0f03e6e0c5fc93a72bcfda Mon Sep 17 00:00:00 2001 From: luoxiao Date: Tue, 13 Jun 2023 13:49:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20gh-pages=20mobile=20page?= =?UTF-8?q?=20show=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gh-pages/src/app.rs | 4 ++-- gh-pages/src/pages/home.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gh-pages/src/app.rs b/gh-pages/src/app.rs index a29aadd..2e66b3d 100644 --- a/gh-pages/src/app.rs +++ b/gh-pages/src/app.rs @@ -26,10 +26,10 @@ pub fn App(cx: Scope) -> impl IntoView { } /> + } /> + } /> diff --git a/gh-pages/src/pages/home.rs b/gh-pages/src/pages/home.rs index 8d41b0c..4022cce 100644 --- a/gh-pages/src/pages/home.rs +++ b/gh-pages/src/pages/home.rs @@ -1,9 +1,17 @@ use leptos::*; -use leptos_router::use_navigate; +use leptos_router::{use_navigate, use_query_map}; use melt_ui::*; #[component] pub fn Home(cx: Scope) -> impl IntoView { + let query_map = use_query_map(cx).get(); + if let Some(path) = query_map.get("path") { + let path = store_value(cx, path.clone()); + request_animation_frame(move || { + let navigate = use_navigate(cx); + _ = navigate(&path.get_value(), Default::default()); + }); + } let (theme, set_theme) = create_signal(cx, Theme::light()); provide_context(cx, theme); let (count, set_count) = create_signal(cx, 0.0);