Fix up TodoMVC example and add build script on client side

This commit is contained in:
Greg Johnston 2022-10-13 16:42:00 -04:00
parent 07a9be5bcf
commit 2c90922385
4 changed files with 4 additions and 3 deletions

View file

@ -9,7 +9,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
console_log = "0.2"
leptos = { path = "../../../leptos", features = ["hydrate"] }
todomvc = { path = "../../todomvc", features = ["hydrate"] }
todomvc = { path = "../../todomvc", default-features = false, features = ["hydrate"] }
log = "0.4"
wasm-bindgen = "0.2"
wee_alloc = "0.4"

View file

@ -0,0 +1 @@
wasm-pack build --target=web --release

View file

@ -19,7 +19,7 @@ lto = true
opt-level = 'z'
[features]
default = ["hydrate"]
default = ["csr"]
csr = ["leptos/csr"]
hydrate = ["leptos/hydrate"]
ssr = ["leptos/ssr"]

View file

@ -273,7 +273,7 @@ pub fn Todo(cx: Scope, todo: Todo) -> Element {
class="edit"
class:hidden={move || !(editing)()}
prop:value={move || todo.title.get()}
on:focusout=|ev| save(&event_target_value(&ev))
on:focusout=move |ev| save(&event_target_value(&ev))
on:keyup={move |ev| {
let key_code = ev.unchecked_ref::<web_sys::KeyboardEvent>().key_code();
if key_code == ENTER_KEY {