创建和控制浏览器窗口

5年以前  |  阅读数:364 次  |  编程语言:JavaScript 
// 在主进程中.
const { BrowserWindow } = require('electron')

// 或者从渲染进程中使用 `remote`.
// const { BrowserWindow } = require('electron').remote

let win = new BrowserWindow({ width: 800, height: 600 })
win.on('closed', () => {
  win = null
})

// 加载远程URL
win.loadURL('https://github.com')

// 或加载本地HTML文件
win.loadURL(`file://${__dirname}/app/index.html`)

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8