button.rs 413 B

123456789101112131415161718
  1. use dioxus::prelude::*;
  2. fn main() {
  3. dioxus_desktop::launch(app);
  4. }
  5. fn app(cx: Scope) -> Element {
  6. cx.render(rsx! {
  7. button {
  8. onclick: |e| async move {
  9. println!("hello, desktop!");
  10. tokio::time::sleep(std::time::Duration::from_secs(1)).await;
  11. println!("goodbye, desktop!");
  12. },
  13. "hello, desktop!"
  14. }
  15. })
  16. }