Javascript 在电子闭合主流程上以角度运行打印
我试图在angular electron应用程序中打印Javascript 在电子闭合主流程上以角度运行打印,javascript,angular,electron,Javascript,Angular,Electron,我试图在angular electron应用程序中打印,当我单击打印时(有时当我关闭新窗口时),它也会关闭主进程。我无法登录,无法检查导致此问题的原因 梅因酒店 win = new BrowserWindow({ x: 0, y: 0, width: size.width, height: size.height, webPreferences: { nativeWindowOpen: true, // set as true
,当我单击打印时(有时当我关闭新窗口时),它也会关闭主进程。我无法登录,无法检查导致此问题的原因
梅因酒店
win = new BrowserWindow({
x: 0,
y: 0,
width: size.width,
height: size.height,
webPreferences: {
nativeWindowOpen: true, // set as true
nodeIntegration: true,
allowRunningInsecureContent: (serve) ? true : false,
enableRemoteModule: true
},
});
...
app.on('window-all-closed', (e) => {
e.preventDefault(); // added this line
if (process.platform !== 'darwin') {
app.quit();
}
});
details.component.ts
printFees() {
var prtContent = document.getElementById('print-section');
var WinPrint = window.open('', '_blank', 'left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0');
WinPrint.document.open();
WinPrint.document.write(prtContent.innerHTML);
WinPrint.setTimeout(function () {
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}, 1000);
}
你解决了吗?不,这是电子中的错误,你可以在这里检查问题。作为临时解决方案,我正在使用