如何在angular-cli的组件内使用电子浏览器窗口?

2022-01-10 00:00:00 electron javascript angular angular-cli

Angular-cli 不接受组件内部的电子.如何在angular-cli的组件内使用电子浏览器窗口?我得到一个像这样的错误 fs.existsync .有没有其他选项可以将电子与 angular2 组件一起使用?

Angular-cli doesn't accept the electron inside components. how to use electron browser window inside components in angular-cli? I got an error fs.existsync like this. Is there any other options to use electron with angular2 components?

var electron = require('electron');

   import electron from 'electron';

两者都不能在 ts 中工作?

Both are not working inside ts?

推荐答案

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <script src="http://code.jquery.com/jquery-2.1.1.js"></script>
  <title>Workdesk 2.0</title>
  <!--<base href="./">-->
  <base href="./">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" href="styles.css">
  <script src="assets/jquery.js"></script>
</head>
<body style="margin: 0px;">
  <app-root>  </app-root>
  <script>
    var electron = require('electron');
    var BrowserWindow = require('electron').remote.BrowserWindow;
    var ipcMain = require('electron').remote.ipcMain;
    var shell = require('electron').shell;
    var Positioner = require('electron-positioner');
    var path = require('path');
    var gkm = require('gkm');
    var fs = require('fs');
    var os = require('os');
    var path = require('path');
    var base64Img = require('base64-img');
    var ip = require('ip');
  </script>
</body>
</html>

这将帮助您使用任何脚本语言(如 angular2、react js、node js 等)与电子通信,

This will help you to communicate with electron in any of the script languages like angular2,react js, node js etc.,

相关文章