mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 14:54:16 +00:00
fix stable examples
This commit is contained in:
parent
e0e67360aa
commit
e837e9fded
1 changed files with 3 additions and 6 deletions
|
@ -28,7 +28,7 @@ pub fn Counters() -> impl IntoView {
|
||||||
let add_counter = move |_| {
|
let add_counter = move |_| {
|
||||||
let id = next_counter_id.get();
|
let id = next_counter_id.get();
|
||||||
let sig = ArcRwSignal::new(0);
|
let sig = ArcRwSignal::new(0);
|
||||||
set_counters.update(move |counters| counters.push((*id, sig)));
|
set_counters.update(move |counters| counters.push((id, sig)));
|
||||||
set_next_counter_id.update(|id| *id += 1);
|
set_next_counter_id.update(|id| *id += 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ pub fn Counters() -> impl IntoView {
|
||||||
<span>{move ||
|
<span>{move ||
|
||||||
counters.get()
|
counters.get()
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(_, (count, _))| count.get())
|
.map(|(_, count)| count.get())
|
||||||
.sum::<i32>()
|
.sum::<i32>()
|
||||||
.to_string()
|
.to_string()
|
||||||
}</span>
|
}</span>
|
||||||
|
@ -95,10 +95,7 @@ fn Counter(id: usize, value: ArcRwSignal<i32>) -> impl IntoView {
|
||||||
<li>
|
<li>
|
||||||
<button on:click=move |_| value.update(move |value| *value -= 1)>"-1"</button>
|
<button on:click=move |_| value.update(move |value| *value -= 1)>"-1"</button>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
prop:value={
|
prop:value=value
|
||||||
// TODO: implement attribute/prop types for guards
|
|
||||||
move || *value()
|
|
||||||
}
|
|
||||||
on:input:target=move |ev| { value.set(ev.target().value().parse::<i32>().unwrap_or_default()) }
|
on:input:target=move |ev| { value.set(ev.target().value().parse::<i32>().unwrap_or_default()) }
|
||||||
/>
|
/>
|
||||||
<span>{value.clone()}</span>
|
<span>{value.clone()}</span>
|
||||||
|
|
Loading…
Reference in a new issue