Browse Source

fix: no type

Jonathan Kelley 2 years ago
parent
commit
4955cfc940
3 changed files with 36 additions and 2 deletions
  1. 1 1
      examples/multiwindow.rs
  2. 34 0
      examples/overlay.rs
  3. 1 1
      packages/desktop/src/desktop_context.rs

+ 1 - 1
examples/multiwindow.rs

@@ -12,7 +12,7 @@ fn app(cx: Scope) -> Element {
         div {
             button {
                 onclick: move |_| {
-                    let dom = VirtualDom::new_with_props(app, props);
+                    let dom = VirtualDom::new(app);
                     window.new_window(dom, Default::default());
                 },
                 "New Window"

+ 34 - 0
examples/overlay.rs

@@ -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!"
+        }
+    })
+}

+ 1 - 1
packages/desktop/src/desktop_context.rs

@@ -77,7 +77,7 @@ impl DesktopContext {
     }
 
     /// 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.proxy
             .send_event(UserWindowEvent(EventData::NewWindow, self.id()))