通常当我使用frame: false
时,在像Windows这样的平台上,它会将窗口隐藏在窗口顶部以及按钮上。我非常喜欢这个功能,我想在运行raspbian的Raspberry Pi上使用它。
我已将NPM
更新为最新版本。我也试过了--enable-transparent-visuals --disable-gpu
,但它似乎没有用。无论如何,这是我目前的main.js:
const {app, BrowserWindow} = require('electron');
const path = require('path');
const url = require('url');
let win;
function createWindow () {
win = new BrowserWindow({width: 800, height: 600});
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true,
frame: false
}));
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
})
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
这是我的package.js:
{
"name": "myApp",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^1.6.11"
}
}
答案 0 :(得分:0)