feat(example): add slider page

This commit is contained in:
luoxiao 2023-05-18 12:21:31 +08:00
parent 8efe55780d
commit 571191fb4f
3 changed files with 18 additions and 0 deletions

View file

@ -10,6 +10,9 @@ pub fn App(cx: Scope) -> impl IntoView {
<Route path="/" view=move |cx| view! {cx,
<Home />
} />
<Route path="/slider" view=move |cx| view! {cx,
<SliderPage />
} />
</Routes>
</Router>
}

View file

@ -1,3 +1,5 @@
mod home;
mod slider;
pub use home::*;
pub use slider::*;

View file

@ -0,0 +1,13 @@
use leptos::*;
use melt_ui::*;
#[component]
pub fn SliderPage(cx: Scope) -> impl IntoView {
let (value, set_value) = create_signal(cx, 0.0);
let on_value = SignalSetter::map(cx, move |value| {
set_value.set(value);
});
view! { cx,
<Slider value=value on_value=on_value/>
}
}