在开发桌面端应用我们常常需要弹出一个提示窗体或者对话框,而提示窗体和对话框和普通窗体的区别是,在提示框出现时,其它窗体就被锁定了,必须要等到提示框被正确关闭时其它窗体才能“解锁”,这种类型的窗体叫做模态窗。在Electron中实现起来也非常的简单:

ES5:

var top = require('electron').remote.getCurrentWindow();
var child = new BrowserWindow({parent: top, modal: true, show: show});
child.loadURL('https://github.com');

ES6:

const {remote} = require('electron');
let top = remote.getCurrentWindow();
let child = new BrowserWindow({parent: top, modal: true, show: show});
child.loadURL('https://github.com');

 

相关文章:

  • 2021-07-21
  • 2021-10-09
  • 2021-11-04
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-30
  • 2021-12-16
  • 2022-12-23
  • 2021-12-26
  • 2022-02-14
相关资源
相似解决方案