未验证 提交 d150e1ed 编写于 作者: 徐晓伟's avatar 徐晓伟 提交者: GitHub

Merge pull request #20 from xuxiaowei-com-cn/Electron_12_学习(四)Vue_CLI_Plugin_Electron_Builder_安装与配置

优化浏览器启动窗口
...@@ -14,9 +14,11 @@ protocol.registerSchemesAsPrivileged([ ...@@ -14,9 +14,11 @@ protocol.registerSchemesAsPrivileged([
async function createWindow() { async function createWindow() {
// Create the browser window. // Create the browser window.
const win = new BrowserWindow({ const win = new BrowserWindow({
show: false,
width: 800, width: 800,
height: 600, height: 600,
webPreferences: { webPreferences: {
// eslint-disable-next-line no-undef
preload: path.join(__static, 'preload.js'), preload: path.join(__static, 'preload.js'),
// Use pluginOptions.nodeIntegration, leave this alone // Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
...@@ -34,6 +36,10 @@ async function createWindow() { ...@@ -34,6 +36,10 @@ async function createWindow() {
// Load the index.html when not in development // Load the index.html when not in development
win.loadURL('app://./index.html') win.loadURL('app://./index.html')
} }
win.once('ready-to-show', () => {
win.show()
})
} }
// Quit when all windows are closed. // Quit when all windows are closed.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册