Closed sadtaco closed 3 years ago
After further digging, the close is only prevented with inspector/devtools open. If I close those first, everything works normally. However, that is not how it works with the non-vue electron quickstart guide. In that case, I can still close with devtools open.
I did also find an almost duplicate https://github.com/electron/electron/issues/25012 except for, as noted above, I'm NOT having the same issue of being unable to alt+f4 or ctrl+w with dev tools open in a basic electron example from their quickstart guide.
The same
win.on('close', () => { if (win.webContents.isDevToolsOpened()) { win.webContents.closeDevTools() } })
workaround does work here.
Describe the bug BrowserWindow.close() and app.close() works fine when
frame: true
is set, or left to default. ctrl+w closes. alt+f4 closes. However once I setframe: false
on BrowserWindow config, none of these work and the only way to close it is through the Task Manager (in Windows), closing the shell/VSCode it's launched from, or by re-running the electron:serve script.To Reproduce Follow the quick-start guide @ https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/#installation on top of the basic vue3 hello world quickstart. I forget if electron-builder creates the hello world itself or not but it's simply
vue create hello-world
for that. Replace the boilerplate background.js and App.vue created above with the pastes in https://pastebin.com/VW9JchnM Add the /src/components/App-titlebar.vue and /src/preloader.js from that same paste. Runelectron:serve
Try and close the window...If you change
frame
totrue
you'll find the close buttons and hotkeys all work fine, however.Expected behavior Close button and hotkeys should all work to close it.
Environment (please complete the following information):
module.exports = { publicPath: process.env.NODE_ENV === 'production' ? './' : '/', pluginOptions: { electronBuilder: { preload: 'src/preload.js', contextIsolation: true } } }
vue info
:System: OS: Windows 10 10.0.18363 CPU: (12) x64 AMD Ryzen 5 1600X Six-Core Processor Binaries: Node: 14.15.4 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 6.14.10 - ~\AppData\Roaming\npm\npm.CMD Browsers: Chrome: 88.0.4324.146 Edge: Spartan (44.18362.449.0) npmPackages: @vue/babel-helper-vue-jsx-merge-props: 1.2.1 @vue/babel-helper-vue-transform-on: 1.0.2 @vue/babel-plugin-jsx: 1.0.2 @vue/babel-plugin-transform-vue-jsx: 1.2.1 @vue/babel-preset-app: 4.5.11 @vue/babel-preset-jsx: 1.2.4 @vue/babel-sugar-composition-api-inject-h: 1.2.1 @vue/babel-sugar-composition-api-render-instance: 1.2.4 @vue/babel-sugar-functional-vue: 1.2.2 @vue/babel-sugar-inject-h: 1.2.2 @vue/babel-sugar-v-model: 1.2.3 @vue/babel-sugar-v-on: 1.2.3 @vue/cli-overlay: 4.5.11 @vue/cli-plugin-babel: ~4.5.0 => 4.5.11 @vue/cli-plugin-eslint: ~4.5.0 => 4.5.11 @vue/cli-plugin-router: 4.5.11 @vue/cli-plugin-vuex: 4.5.11 @vue/cli-service: ~4.5.0 => 4.5.11 @vue/cli-shared-utils: 4.5.11 @vue/compiler-core: 3.0.5 @vue/compiler-dom: 3.0.5 @vue/compiler-sfc: ^3.0.0 => 3.0.5 @vue/compiler-ssr: 3.0.5 @vue/component-compiler-utils: 3.2.0 @vue/preload-webpack-plugin: 1.1.2 @vue/reactivity: 3.0.5 @vue/runtime-core: 3.0.5 @vue/runtime-dom: 3.0.5 @vue/shared: 3.0.5 @vue/web-component-wrapper: 1.2.0 emoji-mart-vue-fast: ^7.0.2 => 7.0.2 eslint-plugin-vue: ^7.0.0-0 => 7.5.0 vue: ^3.0.5 => 3.0.5 vue-cli-plugin-electron-builder: ~2.0.0-rc.6 => 2.0.0-rc.6 vue-eslint-parser: 7.4.1 vue-hot-reload-api: 2.3.4 vue-loader: ^16.0.0-beta.4 => 16.0.0-beta.4 (15.9.6, 16.1.2) vue-observe-visibility: 0.4.6 vue-resize: 0.4.5 vue-router: ^3.5.1 => 3.5.1 vue-style-loader: 4.1.2 vue-template-compiler: ^2.6.11 => 2.6.11 vue-template-es2015-compiler: 1.9.1 vue-virtual-scroller: 1.0.10 npmGlobalPackages: @vue/cli: Not Found
Not sure why I get@vue/cli: Not Found
there.vue --version
outputs fine for me.