1
0

disabled.rs 536 B

12345678910111213141516171819202122232425
  1. use dioxus::prelude::*;
  2. fn main() {
  3. dioxus::desktop::launch(app);
  4. }
  5. fn app(cx: Scope) -> Element {
  6. let disabled = use_state(&cx, || false);
  7. cx.render(rsx! {
  8. div {
  9. button {
  10. onclick: move |_| disabled.set(!disabled),
  11. "click to "
  12. [if disabled == true {"enable"} else {"disable"}]
  13. " the lower button"
  14. }
  15. button {
  16. disabled: "{disabled}",
  17. "lower button"
  18. }
  19. }
  20. })
  21. }