SimulatedGREG / electron-vue

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
https://simulatedgreg.gitbooks.io/electron-vue/content/
MIT License
15.47k stars 1.54k forks source link

electron-vue使用dialog报错 #1017

Open jiangfeng3 opened 4 years ago

jiangfeng3 commented 4 years ago

#### Found an issue or bug with electron-vue? Tell me all about it! Questions regarding how to use electron or vue are likely to be closed as they are not direct issues with this boilerplate. Please seek solutions from official documentation or their respective communities.

Describe the issue / bug.

#

How can I reproduce this problem?

#

If visual, provide a screenshot.

#

Tell me about your development environment.

If you are looking to suggest an enhancement or feature, then feel free to remove everything above.

subins2000 commented 4 years ago

Can't open dialog. Getting "TypeError: Cannot read property 'showOpenDialogSync' of undefined". The code was :

mounted () {
  console.log(this.$electron.dialog.showOpenDialogSync({ properties: ['openDirectory'] }))
}

Never mind, fixed it by using :

console.log(this.$electron.remote.dialog.showOpenDialogSync({ properties: ['openDirectory'] }))