Reputation: 243
I am making a frameless application using electron and vuejs and I would like to know how I would go abouts closing the app once the exit button is clicked.
I have tried using this code in home.vue but it was not successful, as it just made my app blank:
<script>
const remote = require('electron').remote
export default {
data(){
return{
w: remote.getCurrentWindow(),
}
},
methods: {
close(){
this.w.close()
},
}
}
</script>
Since I am still new to this and have only started out, what other methods can I use and what have I done wrong? Any help would be appreciated.
Upvotes: 0
Views: 874
Reputation: 243
If anyone else comes across this, the following code worked for me (in Home.vue):
<v-btn @click='buttonClose'></v-btn>
...
<script>
methods: {
buttonClose: function () {
window.close();
}
}
</script>
Thanks to garudamon and dj burb for leading me to the solution
Upvotes: 0
Reputation: 197
refer to this document, you can use app.exit()
const { app } = require('electron')
export default {
methods: {
buttonClose: function() {
app.quit();
}
}
};
Upvotes: 1