Skip to content

Commit

Permalink
Use new prevent_default form in todomvc example
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Oct 7, 2024
1 parent 74ce970 commit 537b7b2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions examples/todomvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,18 @@ fn TodoEntry(mut todos: Signal<HashMap<u32, TodoItem>>, id: u32) -> Element {
}
label {
r#for: "cbg-{id}",
ondoubleclick: move |_| is_editing.set(true),
prevent_default: "onclick",
onclick: move |evt| {
is_editing.set(true);
evt.prevent_default()
},
"{contents}"
}
button {
class: "destroy",
onclick: move |_| {
onclick: move |evt| {
todos.write().remove(&id);
evt.prevent_default();
},
prevent_default: "onclick"
}
}

Expand Down Expand Up @@ -242,8 +244,10 @@ fn ListFooter(
a {
href: url,
class: if filter() == state { "selected" },
onclick: move |_| filter.set(state),
prevent_default: "onclick",
onclick: move |evt| {
filter.set(state)
evt.prevent_default()
},
{state_text}
}
}
Expand Down

0 comments on commit 537b7b2

Please sign in to comment.