小编dit*_*kts的帖子

多个窗口的电子最佳方式

打开多个BrowserWindows的正确方法是什么?我这样做,到目前为止效果很好。取得一系列胜利更好吗?

let win;

function createWindow () {
  for (i=0; i<loadNotes.notes.length; i++){
  win = new BrowserWindow({
    'x': loadNotes.notes[i].pos.x,
    'y': loadNotes.notes[i].pos.y,
    'width': loadNotes.notes[i].pos.width,
    'height': loadNotes.notes[i].pos.height,
    'frame': false});

  win.setMenu(null);
  win.loadURL(`file://${__dirname}/index.html?${loadNotes.notes[i].name}`);
  //win.webContents.openDevTools()
  }
  win.on('close', () => {

  })

  win.on('closed', () => {
    win = null
  });
}
Run Code Online (Sandbox Code Playgroud)

electron

2
推荐指数
2
解决办法
1万
查看次数

标签 统计

electron ×1