【发布时间】:2018-03-11 03:11:43
【问题描述】:
我正在使用 Electron 和 Angular 4 开发应用程序。我想在单击按钮以选择文件夹时显示一个对话框,但 electron API 存在问题:
我见过很多人有同样的问题,但我找不到解决这个问题的方法。我试图通过添加一个需要 fs 模块的脚本来修改 angular-cli 配置,但它也失败了......
我的组件如下所示:
import { Component, OnInit } from '@angular/core';
import { dialog } from 'electron';
@Component({
selector: 'app-photos',
templateUrl: './photos.component.html'
})
export class PhotosComponent implements OnInit {
private path = '';
private photos = ['A', 'B', 'C'];
constructor() { }
ngOnInit() {
}
openFolderSelector() {
dialog.showOpenDialog({ properties: ['openDirectory'] }, (filepaths) => {
console.log(filepaths);
});
}
}
有人成功了吗?
感谢您的帮助!
【问题讨论】:
-
您找到解决问题的方法了吗?我正在为同样的错误而苦苦挣扎……
标签: angular web-applications electron desktop fs