0

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.

noobcode0000
  • 213
  • 6
  • 17

2 Answers2

1

refer to this document, you can use app.exit()

const { app } = require('electron')
export default {
  methods: {
    buttonClose: function() {
      app.quit();
    }
  }
};
garudamon
  • 197
  • 5
0

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

noobcode0000
  • 213
  • 6
  • 17