dioxus/examples/button.rs

19 lines
413 B
Rust
Raw Normal View History

2022-12-22 19:45:48 +00:00
use dioxus::prelude::*;
fn main() {
dioxus_desktop::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx! {
button {
2023-02-07 06:18:07 +00:00
onclick: |_| async move {
println!("hello, desktop!");
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
println!("goodbye, desktop!");
},
"hello, desktop!"
}
2022-12-22 19:45:48 +00:00
})
}