有什么方法可以让我使用以下代码来打开 NW.JS 应用程序内部名为“projects”的文件夹的文件对话框?我已经尝试过这里的文档... https://github.com/nwjs/nw.js/wiki/file-dialogs但还没有找到我要找的东西
<input id="fileDialog" type="file">
<script>
document.querySelector('#fileDialog')
.addEventListener("change", function() {
var filePath = this.value;
alert(filePath);
});
</script>
最佳答案
<label for="fileDialogOPEN"><img src="../images/open.png" style="width:20px;background:none;"></label>
<div id="openBUT"></div>
<script>
var nwDir = process.cwd() + "/projects";
var goForIt = '<input id="fileDialogOPEN" nwworkingdir="' + nwDir + '" type="file" name="photo" style="display: none;" >';
$("#openBUT").append(goForIt);
document.querySelector('#fileDialogOPEN')
.addEventListener("change", function() {
var filePath = this.value;
alert(filePath);
});
</script>
关于javascript - 如何在 NW.JS 中打开文件对话框以打开应用程序内的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45942845/