dioxus/examples/multiwindow.rs

23 lines
383 B
Rust
Raw Normal View History

2022-12-31 03:05:15 +00:00
use dioxus::prelude::*;
fn main() {
launch_desktop(app);
2022-12-31 03:05:15 +00:00
}
fn app() -> Element {
2024-01-20 08:11:55 +00:00
let onclick = move |_| {
let dom = VirtualDom::new(popup);
dioxus::desktop::window().new_window(dom, Default::default());
};
2024-01-16 19:18:46 +00:00
rsx! {
2024-01-20 08:11:55 +00:00
button { onclick, "New Window" }
2024-01-14 05:12:21 +00:00
}
2022-12-31 03:05:15 +00:00
}
fn popup() -> Element {
2024-01-16 19:18:46 +00:00
rsx! {
2024-01-20 08:11:55 +00:00
div { "This is a popup window!" }
2024-01-14 05:12:21 +00:00
}
2022-12-31 03:05:15 +00:00
}