2021-07-29 01:46:53 +00:00
|
|
|
#![allow(non_upper_case_globals, non_snake_case)]
|
2021-07-26 16:14:48 +00:00
|
|
|
//! Example: Webview Renderer
|
|
|
|
//! -------------------------
|
|
|
|
//!
|
|
|
|
//! This example shows how to use the dioxus_desktop crate to build a basic desktop application.
|
|
|
|
//!
|
2021-10-24 17:30:36 +00:00
|
|
|
//! Under the hood, the dioxus_desktop crate bridges a native Dioxus VirtualDom with a custom prebuilt application running
|
2021-07-26 16:14:48 +00:00
|
|
|
//! in the webview runtime. Custom handlers are provided for the webview instance to consume patches and emit user events
|
|
|
|
//! into the native VDom instance.
|
|
|
|
//!
|
|
|
|
//! Currently, NodeRefs won't work properly, but all other event functionality will.
|
|
|
|
|
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2021-12-15 20:56:53 +00:00
|
|
|
dioxus::web::launch(App);
|
2021-07-26 16:14:48 +00:00
|
|
|
}
|
|
|
|
|
2021-12-15 20:56:53 +00:00
|
|
|
static App: Component<()> = |cx| {
|
|
|
|
let mut count = use_state(&cx, || 0);
|
2021-07-26 16:14:48 +00:00
|
|
|
|
|
|
|
cx.render(rsx! {
|
|
|
|
div {
|
|
|
|
h1 { "Hifive counter: {count}" }
|
|
|
|
button { onclick: move |_| count += 1, "Up high!" }
|
|
|
|
button { onclick: move |_| count -= 1, "Down low!" }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
};
|