electron window show时顶层
您可以使用win.setAlwaysOnTop(true)方法将Electron窗口设置为始终处于顶层。例如:
const { app, BrowserWindow } = require('electron')
let win
function createWindow () {
win = new BrowserWindow({
width: 800,
height: 600,
alwaysOnTop: true, //设置始终处于顶层
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('index.html')
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()
}
})
``
原文地址: https://www.cveoy.top/t/topic/fKCn 著作权归作者所有。请勿转载和采集!