我正在从 JavaScript 发送一个 FileList 并尝试从列表中读取特定文件的参数,例如文件名,但我收到错误:(我method not found in Option<web_sys::File>
尝试了不同的变体来调用 File 的 getter 方法,例如在web-sys 文档中定义但没有成功)。
#[wasm_bindgen]
pub fn get_file_list_detail(files : web_sys::FileList) -> Option<web_sys::File> {
let first_file = files.get(1);
log!("Test console log from rust {:?}=",first_file.name()); //this is not working
return first_file;
}
我在 Cargo.toml 中添加了File
and :FileList
[dependencies.web-sys]
version = "0.3"
features = [
"HtmlInputElement",
"FileList",
"File",
"console"
]