add a desktop eval example
This commit is contained in:
1 file changed
+25
@@ -0,0 +1,25 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus::desktop::launch(app);
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let script = use_state(&cx, String::new);
|
||||
let eval = use_eval(&cx);
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
input {
|
||||
placeholder: "Enter an expression",
|
||||
value: "{script}",
|
||||
oninput: move |e| script.set(e.value.clone()),
|
||||
}
|
||||
button {
|
||||
onclick: move |_| eval(script),
|
||||
|
||||
"Execute"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user