example: update example

This commit is contained in:
YuKun Liu committed 2022-05-12 08:41:30 +08:00
1 parent 31a2ded2b9
commit 3f4897cd1c
1 file changed
+3 -3
+3 -3
View File
@@ -9,14 +9,14 @@ fn app(cx: Scope) -> Element {
let window = use_window(&cx);
let level = use_state(&cx, || 1.0);
window.set_zoom_level(*level.get());
cx.render(rsx! {
input {
r#type: "number",
value: "{level}",
oninput: |e| {
level.set(e.value.parse::<f64>().unwrap_or_default())
let num = e.value.parse::<f64>().unwrap_or(1.0);
level.set(num);
window.set_zoom_level(num);
}
}
})