diff --git a/src/loader.rs b/src/loader.rs index 0e0510b..5497c5c 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -124,25 +124,30 @@ impl Component for Loader { } fn view(&self, ctx: &Context) -> Html { - let link = ctx.link(); + let cb = move |e: Event| { + let mut result = Vec::new(); + let input: HtmlInputElement = e.target_unchecked_into(); + + if let Some(files) = input.files() { + let files = js_sys::try_iter(&files) + .unwrap() + .unwrap() + .map(|v| web_sys::File::from(v.unwrap())) + .map(File::from); + result.extend(files); + } + Msg::StartLoad(result) + }; + html! { if self.is_loading { {"processing..."} } else { - } }