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] [dependencies]
console_log = "0.2" console_log = "0.2"
leptos = { path = "../../../leptos", features = ["hydrate"] } leptos = { path = "../../../leptos", features = ["hydrate"] }
todomvc = { path = "../../todomvc", features = ["hydrate"] } todomvc = { path = "../../todomvc", default-features = false, features = ["hydrate"] }
log = "0.4" log = "0.4"
wasm-bindgen = "0.2" wasm-bindgen = "0.2"
wee_alloc = "0.4" 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' opt-level = 'z'
[features] [features]
default = ["hydrate"] default = ["csr"]
csr = ["leptos/csr"] csr = ["leptos/csr"]
hydrate = ["leptos/hydrate"] hydrate = ["leptos/hydrate"]
ssr = ["leptos/ssr"] ssr = ["leptos/ssr"]

View file

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