feat: remove dioxus id on non-event elements

This commit is contained in:
Jonathan Kelley committed 2022-01-21 15:06:57 -05:00
1 parent 997684a390
commit 95e93ed0bc
7 files changed
+888 -903

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
//! Nested Listeners
//!
//! This example showcases how to control event bubbling from child to parents.
//!
//! Both web and desktop support bubbling and bubble cancelation.
use dioxus::prelude::*;
fn main() {
dioxus::desktop::launch(app);
}
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div {
onclick: move |_| println!("clicked! top"),
button {
onclick: move |_| println!("clicked! bottom propoate"),
"Propogate"
}
button {
onclick: move |evt| {
println!("clicked! bottom no bubbling");
evt.cancel_bubble();
},
"Dont propogate"
}
button {
"Does not handle clicks"
}
}
})
}