feat: add DesktopContext

This commit is contained in:
mrxiaozhuox committed 2022-01-31 00:33:14 +08:00
1 parent 1ec583206f
commit 169028705d
3 files changed
+71 -91

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
use dioxus::prelude::*;
use dioxus_desktop::desktop_context::DesktopContext;
fn main() {
dioxus::desktop::launch_cfg(app, |cfg| {
cfg.with_window(|w| {
w.with_title("BorderLess Demo")
.with_decorations(false)
})
});
}
fn app (cx: Scope) -> Element {
let desktop = cx.consume_context::<DesktopContext>().unwrap();
cx.render(rsx!(
div {
style: "background-color: black; height: 20px; width: 100%",
onmousedown: move |_| desktop.drag_window(),
}
))
}