some minor updates

This commit is contained in:
2024-11-30 06:46:48 +01:00
parent 69d2943bb3
commit f10e216d9c
6 changed files with 38 additions and 126 deletions
+2 -18
View File
@@ -1,21 +1,5 @@
use osui::prelude::*;
use osui::{examples::examples, prelude::*};
fn main() {
launch!(app());
}
// A simple counter
fn app() -> Element {
rsx! {
// Create a button with a on_click handler
button { on_click: Handler::new(move |btn: &mut Button, _, document| {
if let Some(count) = document.get_element_by_id::<DataHolder<u32>>("count") {
count.data += 1;
btn.children.set_text(&count.data.to_string());
}
}), "0" }
// Store the data (in this case count)
data_holder as u32 { id: "count" }
}
launch!(examples());
}