dioxus/examples/multiwindow.rs

26 lines
465 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-16 19:18:46 +00:00
rsx! {
2022-12-31 03:05:15 +00:00
div {
button {
onclick: move |_| {
let dom = VirtualDom::new(popup);
2024-01-20 00:36:40 +00:00
dioxus::desktop::window().new_window(dom, Default::default());
2022-12-31 03:05:15 +00:00
},
"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! {
2022-12-31 03:05:15 +00:00
div { "This is a popup!" }
2024-01-14 05:12:21 +00:00
}
2022-12-31 03:05:15 +00:00
}