dioxus/examples/multiwindow.rs

26 lines
456 B
Rust
Raw Normal View History

2022-12-31 03:05:15 +00:00
use dioxus::prelude::*;
fn main() {
launch(app);
2022-12-31 03:05:15 +00:00
}
fn app() -> Element {
2024-01-14 05:12:21 +00:00
rsx! {
2022-12-31 03:05:15 +00:00
div {
button {
onclick: move |_| {
let dom = VirtualDom::new(popup);
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-14 05:12:21 +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
}