Commit 00f50907 authored by A's avatar A

add open folder

parent f749fa29
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div *ngIf="isInstalled"> <div *ngIf="isInstalled">
<button type="button" class="btn btn-primary">运行</button> <button type="button" class="btn btn-primary">运行</button>
<button type="button" class="btn btn-secondary">设置</button> <button type="button" class="btn btn-secondary">设置</button>
<button type="button" class="btn btn-secondary">游览本地文件</button> <button (click)="openDir(routingService.app)" type="button" class="btn btn-secondary">游览本地文件</button>
<button type="button" class="btn btn-secondary">联机</button> <button type="button" class="btn btn-secondary">联机</button>
</div> </div>
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<div class="input-group"> <div class="input-group">
<input type="text" [(ngModel)]="appsService.installConfig.installDir" name="installDir" class="form-control" placeholder="安装位置"> <input type="text" [(ngModel)]="appsService.installConfig.installDir" name="installDir" class="form-control" placeholder="安装位置">
<span class="input-group-btn"> <span class="input-group-btn">
<button (click)="openDir()" class="btn btn-secondary" type="button">浏览</button> <button (click)="selectDir()" class="btn btn-secondary" type="button">浏览</button>
</span> </span>
</div> </div>
</div> </div>
......
...@@ -130,11 +130,20 @@ export class AppDetailComponent { ...@@ -130,11 +130,20 @@ export class AppDetailComponent {
$("#install-modal").modal("hide"); $("#install-modal").modal("hide");
} }
openDir() { selectDir() {
let dir = this.electron.remote.dialog.showOpenDialog({properties: ['openFile', 'openDirectory']}); let dir = this.electron.remote.dialog.showOpenDialog({properties: ['openFile', 'openDirectory']});
console.log(dir); console.log(dir);
this.appsService.installConfig.installDir = dir[0]; this.appsService.installConfig.installDir = dir[0];
return dir[0]; return dir[0];
} }
openDir(id) {
this.appsService.data.map((v)=>{
if(v.id == id) {
this.electron.remote.shell.showItemInFolder(v.local.path);
}
});
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment