1.打开父子模态创建,
<button @click="showModalHandler">父子模态窗口</button>
//renderer渲染器中主注册事件 showModalHandler() { ipcRenderer.send("child-down-modal"); }
//主进程中触发事件 /** * 父子模态窗口 */ let childDownModal; ipcMain.on('child-down-modal', () => { childDownModal = new BrowserWindow({ parent: mainWindow, modal: true, show: false, width: 300, height: 300, resizable: false, backgroundColor: "#fff", frame: false, hasShadow: true, closable: true, webPreferences: { devTools: false } }) childDownModal.once('ready-to-show', () => { childDownModal.show(); }) childDownModal.loadURL(winURL + '#/downloadModal') }) //关闭模态窗口 ipcMain.on('close-down-modal', () => { childDownModal.hide(); })