import { app, BrowserWindow, screen } from 'electron'
import { Command } from 'commander';
app.whenReady().then(() => {
const command = new Command
let width, height
let options
command
.option('-m, --maximize', 'maximize window')
.option('-l, --location <>', 'location of load index page', 'index.html')
.option('-d, --dev', 'openDevTools')
.option('--no-sandbox', 'other')
.parse()
options = command.opts()
if (options.maximize) {
width = screen.getPrimaryDisplay().workAreaSize.width
height = screen.getPrimaryDisplay().workAreaSize.height
}
else {
width = 800
height = 600
}
const win = new BrowserWindow({
width: width,
height: height,
autoHideMenuBar: true,
webPreferences: {
}
})
if (options.location.indexOf(':') >= 0)
win.loadURL(options.location)
else
win.loadFile(options.location)
if (options.dev)
win.webContents.openDevTools()
})
全屏:./xxx.AppImage -m
文章来源:https://www.toymoban.com/news/detail-605414.html
其他
https://xiaoman.blog.csdn.net/article/details/131713875?spm=1001.2014.3001.5502
https://blog.csdn.net/qq_41544116/article/details/131884282文章来源地址https://www.toymoban.com/news/detail-605414.html
到了这里,关于electron 应用全屏的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!