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
}
})
复制代码