mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-11 07:04:13 +00:00
feat: use dom to allow context injection
This commit is contained in:
parent
880aa737a6
commit
e3a8e44a69
2 changed files with 3 additions and 4 deletions
|
@ -12,7 +12,8 @@ fn app(cx: Scope) -> Element {
|
||||||
div {
|
div {
|
||||||
button {
|
button {
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
window.new_window(popup, (), Default::default());
|
let dom = VirtualDom::new_with_props(app, props);
|
||||||
|
window.new_window(dom, Default::default());
|
||||||
},
|
},
|
||||||
"New Window"
|
"New Window"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ use std::rc::Rc;
|
||||||
use crate::eval::EvalResult;
|
use crate::eval::EvalResult;
|
||||||
use crate::events::IpcMessage;
|
use crate::events::IpcMessage;
|
||||||
use crate::Config;
|
use crate::Config;
|
||||||
use dioxus_core::Component;
|
|
||||||
use dioxus_core::ScopeState;
|
use dioxus_core::ScopeState;
|
||||||
use dioxus_core::VirtualDom;
|
use dioxus_core::VirtualDom;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
@ -78,8 +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, app: Component<T>, props: T, cfg: Config) {
|
pub fn new_window<T: 'static>(&self, dom: VirtualDom, cfg: Config) {
|
||||||
let dom = VirtualDom::new_with_props(app, props);
|
|
||||||
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()))
|
||||||
|
|
Loading…
Reference in a new issue