dioxus/examples/multiwindow.rs

28 lines
544 B
Rust
Raw Normal View History

2022-12-31 03:05:15 +00:00
use dioxus::prelude::*;
fn main() {
dioxus_desktop::launch(app);
}
fn app(cx: Scope) -> Element {
let window = dioxus_desktop::use_window(cx);
2022-12-31 03:05:15 +00:00
cx.render(rsx! {
div {
button {
onclick: move |_| {
let dom = VirtualDom::new(popup);
window.new_window(dom, Default::default());
2022-12-31 03:05:15 +00:00
},
"New Window"
}
}
})
}
fn popup(cx: Scope) -> Element {
cx.render(rsx! {
div { "This is a popup!" }
})
}