From 89a870af7a83cf938208920eaf1abb9044fb0790 Mon Sep 17 00:00:00 2001 From: rewin Date: Tue, 13 Feb 2024 20:51:18 +0300 Subject: [PATCH] Worked changing for trivial --- studio-frontend/src/dioxus-machine.ts | 6 ++++-- studio/src/ui/utils.rs | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/studio-frontend/src/dioxus-machine.ts b/studio-frontend/src/dioxus-machine.ts index 291f190..f45f065 100644 --- a/studio-frontend/src/dioxus-machine.ts +++ b/studio-frontend/src/dioxus-machine.ts @@ -17,6 +17,7 @@ function unpack_vnode( element.setAttribute(attr[0], attr[1]); } element.setAttribute("onchange_id", node_data["onchange"]); + console.log("onchange", node_data["onchange"]); //apply children if (node_data["children"] != undefined) { for (var j = 0; j < node_data["children"].length; j++) { @@ -28,9 +29,10 @@ function unpack_vnode( //add onchange hook if input if (node_data["tag"] == "input") { element.onchange = (event: Event) => { - const input = event.target as HTMLInputElement; + var input = event.target as HTMLInputElement; const id = input.getAttribute("onchange_id"); - if (id) { + if (id != null) { + console.log("onchange", id, input.value); const value = input.value; register_new_change(id, value); } diff --git a/studio/src/ui/utils.rs b/studio/src/ui/utils.rs index 2ea0ff3..980dba7 100644 --- a/studio/src/ui/utils.rs +++ b/studio/src/ui/utils.rs @@ -126,7 +126,7 @@ fn check_predefined(r : &dyn Reflect, onchange : ReflectChange) -> Option ("value".to_string(), vec.x.to_string()), ], children: vec![], - onchange: None + onchange: Some(onchange.add_path("x").to_string()) }), VNode::Text("Y: ".to_string()), VNode::Component(VComponent { @@ -136,7 +136,7 @@ fn check_predefined(r : &dyn Reflect, onchange : ReflectChange) -> Option ("value".to_string(), vec.y.to_string()), ], children: vec![], - onchange: None + onchange: Some(onchange.add_path("y").to_string()) }), VNode::Text("Z: ".to_string()), VNode::Component(VComponent { @@ -146,7 +146,7 @@ fn check_predefined(r : &dyn Reflect, onchange : ReflectChange) -> Option ("value".to_string(), vec.z.to_string()), ], children: vec![], - onchange: None + onchange: Some(onchange.add_path("z").to_string()) }) ], onchange: None