electron 11 設置 transparent: true 小窗口下是透明的,設置了高度和寬度等於或大於顯示的尺寸就會出現不透明狀況html
解決方法:設置 fullscreen: true 能夠避免這個問題vue
const win = new BrowserWindow({
// width: screen.getPrimaryDisplay().workAreaSize.width,
// height: screen.getPrimaryDisplay().workAreaSize.height,
width:600,
height:400,
frame: false,
transparent: true,
// resizable: false, // 是否容許拉伸大小
alwaysOnTop:true,
fullscreen: true,
x:0,
y:0,
// backgroundColor: '#ffffff',
webPreferences: {
devTools: false,
// contextIsolation:false,
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
}
})
複製代碼