-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added folder-select example and cleaned up code
- Loading branch information
1 parent
74e4ef8
commit dfdcd9d
Showing
4 changed files
with
41 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#![allow(non_snake_case)] | ||
use dioxus::prelude::*; | ||
|
||
// ANCHOR: component | ||
pub fn App(cx: Scope) -> Element { | ||
let filenames: &UseRef<Vec<String>> = use_ref(cx, Vec::new); | ||
cx.render(rsx! { | ||
// ANCHOR: rsx | ||
input { | ||
r#type:"file", | ||
// Select a folder by setting the directory attribute | ||
directory: true, | ||
onchange: |evt| { | ||
if let Some(file_engine) = &evt.files { | ||
let files = file_engine.files(); | ||
for file_name in &files { | ||
println!("{}", file_name); | ||
// Do something with the folder path | ||
} | ||
} | ||
} | ||
} | ||
// ANCHOR_END: rsx | ||
}) | ||
} | ||
// ANCHOR_END: component |