well it is at least a wip
parent
7e03cf11a6
commit
46ca6064c3
|
|
@ -0,0 +1 @@
|
||||||
|
/Users/breel/Movies/bel_1_1.mp4
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
|
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use nfd;
|
use rfd::AsyncFileDialog;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// launch the dioxus app in a webview
|
// launch the dioxus app in a webview
|
||||||
|
|
@ -22,6 +22,17 @@ fn App(cx: Scope) -> Element {
|
||||||
input {
|
input {
|
||||||
r#type: "button",
|
r#type: "button",
|
||||||
value: "pick file", onclick: move |evt| {
|
value: "pick file", onclick: move |evt| {
|
||||||
|
to_owned![file];
|
||||||
|
async move {
|
||||||
|
match AsyncFileDialog::new()
|
||||||
|
.pick_file()
|
||||||
|
.await {
|
||||||
|
Some(f) => {
|
||||||
|
file.set(f.file_name().clone()); // TODO swap to .path() on desktop
|
||||||
|
},
|
||||||
|
None => { file.set(format!("<<failed to pick a file>>")); },
|
||||||
|
};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
p { file.get().clone() }
|
p { file.get().clone() }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue