DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.35k stars 740 forks source link

Linux下无法选择文件 #2163

Open aidaodi opened 3 months ago

aidaodi commented 3 months ago
            input {
                r#type: "file",
                multiple: true,
                directory: true,
                onchange: move |evt|{
                    info!("{}", evt.value());
                },
            }

这是我的代码。在0.5.0-alpha.0下是可以选择文件的。升级到0.5.0后,无法选择文件。

araraloren commented 5 days ago

I faced same issue on WSL(Desktop, Vanilla). The terminal just print Got values: [] when press Choose file button.

#![allow(non_snake_case)]

use dioxus::prelude::*;

fn main() {
    dioxus::launch(App);
}

#[component]
fn App() -> Element {
    rsx! {
        input {
            r#type: "file",
            directory: true,
            onchange: move |evt| {
                evt.files()
                    .map(|v| v.files())
                    .iter()
                    .for_each(|v| { println!("Got values: {v:?}") });
            }
        }
    }
}

The version information:

 ~/p/d/directory-bug (main)> rustc --version
rustc 1.79.0 (129f3b996 2024-06-10)
 ~/p/d/directory-bug (main)> dx --version
dioxus 0.5.4
 ~/p/d/directory-bug (main)> cat /etc/redhat-release
Fedora release 39 (Thirty Nine)

The screenshot: Animation