dioxus/examples/multiwindow.rs
Matt Wisniewski 7e54764652
fix(Examples/Multi-Window): launch the popup content instead of app.
Not sure if my assumption is correct but it seemed this was the intention of the popup fn.
2022-12-31 21:00:23 -05:00

28 lines
577 B
Rust

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