1

I am using vue-cli-electron-builder. So how I can quit the application from a button in vue. Thanks.

2 Answers2

2

In your script tag you may create a button on your page and give it an event listener like:

window.close()

or

app.exit(0)
0

Try that

// In your renderer process
const {ipcRenderer} = require('electron');
const closeApp = document.getElementById('closeApp');
closeApp.addEventListener('click', () => {
    ipcRenderer.send('close-me')
});

// In your app main process
const {ipcMain} = require('electron')
ipcMain.on('close-me', (evt, arg) => {
  app.quit()
})
Vitaliy Rayets
  • 2,299
  • 1
  • 6
  • 12