fix stable examples

This commit is contained in:
Greg Johnston 2024-04-09 14:33:03 -04:00
parent e0e67360aa
commit e837e9fded

View file

@ -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>