mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
example: fix so we remove by ID, not by id-as-index
This commit is contained in:
parent
f3f685c923
commit
5ab865e89d
1 changed files with 2 additions and 5 deletions
|
@ -154,17 +154,14 @@ fn TodoRow(
|
||||||
|
|
||||||
<button on:click=move |_| {
|
<button on:click=move |_| {
|
||||||
let id = todo.id().get();
|
let id = todo.id().get();
|
||||||
store
|
store.todos().write().retain(|todo| todo.id != id);
|
||||||
.todos()
|
|
||||||
.update(|todos| {
|
|
||||||
todos.remove(id);
|
|
||||||
});
|
|
||||||
}>"X"</button>
|
}>"X"</button>
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
prop:value=move || {
|
prop:value=move || {
|
||||||
todo.status().scheduled_for_date().map(|n| n.get().to_string())
|
todo.status().scheduled_for_date().map(|n| n.get().to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
class:hidden=move || !todo.status().scheduled_for()
|
class:hidden=move || !todo.status().scheduled_for()
|
||||||
on:change:target=move |ev| {
|
on:change:target=move |ev| {
|
||||||
if let Some(date) = todo.status().scheduled_for_date() {
|
if let Some(date) = todo.status().scheduled_for_date() {
|
||||||
|
|
Loading…
Reference in a new issue