I loaded this listener in the created hook of the vue component:
($electron points to require ("electron"), which is a function of the vue-electron package)
created () {
this.$electron.remote.getCurrentWindow.on("close", (e) => {
e.preventDefault()
}
}
according to the official document, e.preventDefault () will prevent the window from closing, but the window is still closed.
did not find the reason, what is the possible reason?
< hr >the project is built with electron-vue template and runs in development mode
- electron: 1.8.7
- vue: 2.5.13
- vue-router: 3.0.1