fix: no type
This commit is contained in:
1 parent
e3a8e44a69
commit
4955cfc940
3 files changed
+36
-2
No files matched your search
@@ -12,7 +12,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
div {
|
div {
|
||||||
button {
|
button {
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
let dom = VirtualDom::new_with_props(app, props);
|
let dom = VirtualDom::new(app);
|
||||||
window.new_window(dom, Default::default());
|
window.new_window(dom, Default::default());
|
||||||
},
|
},
|
||||||
"New Window"
|
"New Window"
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
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(app);
|
||||||
|
window.new_window(dom, Default::default());
|
||||||
|
},
|
||||||
|
"Open overlay"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn popup(cx: Scope) -> Element {
|
||||||
|
cx.render(rsx! {
|
||||||
|
div {
|
||||||
|
width: "200px",
|
||||||
|
height: "200px",
|
||||||
|
background: "white",
|
||||||
|
border: "1px solid black",
|
||||||
|
"This is a popup!"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -77,7 +77,7 @@ impl DesktopContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new window using the props and window builder
|
/// Create a new window using the props and window builder
|
||||||
pub fn new_window<T: 'static>(&self, dom: VirtualDom, cfg: Config) {
|
pub fn new_window(&self, dom: VirtualDom, cfg: Config) {
|
||||||
self.pending_windows.borrow_mut().push((dom, cfg));
|
self.pending_windows.borrow_mut().push((dom, cfg));
|
||||||
self.proxy
|
self.proxy
|
||||||
.send_event(UserWindowEvent(EventData::NewWindow, self.id()))
|
.send_event(UserWindowEvent(EventData::NewWindow, self.id()))
|
||||||
|
|||||||
Reference in new issue
Block a user