简体   繁体   中英

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. It's the same as with default options. Why is that and how to fix that?

PS I'm using mac

showOpenDialog function takes two parameters. First is browserWindow(optional) and 2nd is options . You are passing options as 1st parameter.

Here is the detailed explanation of this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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