Yew - 选择文件

Yew - Select File

提问人:Oughie 提问时间:10/22/2023 更新时间:10/22/2023 访问量:34

问:

我对红豆杉比较陌生。我想知道如何在 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>
                </>

            }
        }  
    }

我看到了一个关于如何做到这一点的解决方案,但它似乎已经过时了。

文件 输入 紫杉

评论

0赞 Community 10/23/2023
请编辑问题,将其限制为具有足够详细信息的特定问题,以确定适当的答案。

答: 暂无答案