Worked changing for trivial

This commit is contained in:
rewin
2024-02-13 20:51:18 +03:00
parent a81c8d226e
commit 89a870af7a
2 changed files with 7 additions and 5 deletions
+4 -2
View File
@@ -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);
}
+3 -3
View File
@@ -126,7 +126,7 @@ fn check_predefined(r : &dyn Reflect, onchange : ReflectChange) -> Option<VNode>
("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<VNode>
("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<VNode>
("value".to_string(), vec.z.to_string()),
],
children: vec![],
onchange: None
onchange: Some(onchange.add_path("z").to_string())
})
],
onchange: None