提问人:Oughie 提问时间:10/22/2023 更新时间:10/22/2023 访问量:34
Yew - 选择文件
Yew - Select File
问:
我对红豆杉比较陌生。我想知道如何在 Yew 中实现文件选择组件(版本 0.21)
我想选择一个文件并将其存储在“selected_file”下的结构中
pub struct File {
selected_file: Option<String>,
}
impl Component for File {
type Message = ();
type Properties = ();
fn create(_ctx: &Context<Self>) -> Self {
Self {
selected_file: None,
}
}
fn view(&self, _ctx: &Context<Self>) -> Html {
html! {
<>
// Select file...
<p>{format!("Selected file: {:?}", self.selected_file)}</p>
</>
}
}
}
我看到了一个关于如何做到这一点的解决方案,但它似乎已经过时了。
答: 暂无答案
评论