some updates

This commit is contained in:
2024-11-30 06:38:16 +01:00
parent 8557316ad1
commit aee87fcc0c
21 changed files with 1248 additions and 13 deletions
+11 -6
View File
@@ -3,6 +3,7 @@ title: Introduction
slug: /
---
## Installation
On a cargo project run
```bash
cargo add osui
@@ -34,12 +35,16 @@ fn main() {
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" }
button {
on_click: fn(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" }