我正在尝试使用特定路线打开一个新窗口,但似乎路线页面未正确加载。新的电子窗口是从 FrmApprovalMain.js 打开的,新窗口应该用 FrmPOdet.js 打开但是,当它打开时,会出现一个错误,该错误似乎源于调用文件(FrmApprovalMain.js),但没有什么可一旦打开新窗口,就用新窗口做…… mainWIndow 很好,但新打开的窗口抛出一个错误(FrmPOdet.js 上只有一个按钮)。
这是我在新窗口中得到的错误(mainWindow 没有错误):
Module../src/FrmApprovalMain.js
G:/Electron/poa/src/FrmApprovalMain.js:10
7 | import NumberFormat from 'react-number-format';
8 | import ModalMessage from './componentAPI/ModalMessage'
9 | import SpinnerCentre from './componentAPI/SpinnerCentre'
> 10 | const electron = window.require('electron');
11 | const ipcRenderer = electron.ipcRenderer;
12 |
13 |
Run Code Online (Sandbox Code Playgroud)
,这些是我在应用程序中的陈述:
打开新窗口的语句 (FrmApprovalMain.js)
const electron = window.require('electron');
const ipcRenderer = electron.ipcRenderer;
[...]
openPO(){
console.log("Open new window")
ipcRenderer.send('openNewPO', "S");
console.log("New Window Opened")
}
Run Code Online (Sandbox Code Playgroud)
在电子中,我创建了一个新的 IPC 侦听器,我在其中创建了新窗口:
ipcMain.on('openNewPO',(events,args) =>{
const win = new BrowserWindow({
parent: …Run Code Online (Sandbox Code Playgroud)