简体   繁体   English

为什么选项不影响showOpenDialog?

[英]why do options not affect showOpenDialog?

This is the script for my renderer page: 这是我的渲染器页面的脚本:

 const { dialog } = require('electron').remote; function openJsonFile() { dialog.showOpenDialog( { title: 'Open JSON file', properties: ['openFile'], filters: [{name: 'JSON', extensions: 'json'}] }, function (filename) { .... .... .... }) }; 

But the options don't affect showOpenDialog at all. 但是这些选项根本不影响showOpenDialog。 It's the same as with default options. 与默认选项相同。 Why is that and how to fix that? 为什么会这样以及如何解决呢?

PS I'm using mac PS我正在使用mac

showOpenDialog function takes two parameters. showOpenDialog函数showOpenDialog两个参数。 First is browserWindow(optional) and 2nd is options . 第一个是browserWindow(optional) ,第二个是options You are passing options as 1st parameter. 您正在将选项作为第一参数传递。

Here is the detailed explanation of this. 是对此的详细说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM