mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-26 14:10:20 +00:00
9167cd9dec
* fix most typos, add crate-ci/typos to CI --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
28 lines
655 B
Rust
28 lines
655 B
Rust
//! Multiwindow example
|
|
//!
|
|
//! This example shows how to implement a simple multiwindow application using dioxus.
|
|
//! This works by spawning a new window when the user clicks a button. We have to build a new virtualdom which has its
|
|
//! own context, root elements, etc.
|
|
|
|
use dioxus::prelude::*;
|
|
|
|
fn main() {
|
|
launch_desktop(app);
|
|
}
|
|
|
|
fn app() -> Element {
|
|
let onclick = move |_| {
|
|
let dom = VirtualDom::new(popup);
|
|
dioxus::desktop::window().new_window(dom, Default::default());
|
|
};
|
|
|
|
rsx! {
|
|
button { onclick, "New Window" }
|
|
}
|
|
}
|
|
|
|
fn popup() -> Element {
|
|
rsx! {
|
|
div { "This is a popup window!" }
|
|
}
|
|
}
|