"ui";

ui.layout(
    <vertical>
        <button id="calc" align="center">文件选择</button>
        <text id="text_test" text="null"></text>
    </vertical>
);
function pathToArray(dir) {
    current_dir_array = new Array();
    current_dir_array = ["返回上级目录"];
    files.listDir(dir.join("")).forEach((i) => {
        if (files.isDir(dir.join("") + i)) {
            current_dir_array.push(i + "/");
        } else if (files.isFile(dir.join("") + i)) {
            current_dir_array.push(i);
        }
    });
    return current_dir_array;
}
} else if (files.isDir(files.join(dir.join(""), current_dir_array[select_index]))) { dir.push(current_dir_array[select_index]) } }; current_dir_array = pathToArray(dir) dialogs.select("文件选择", current_dir_array).then(n => { file_select(n) }); }; file_select(); });

发表回复

后才能评论