【发布时间】:2021-09-29 04:02:12
【问题描述】:
所以我有一个 Angular 应用程序,其中有 jquery 库,在组件中,我有
included declare var $;
ngOnInit(){$(document).ready{....}}
我已经安装了 ngx-electron 来导入 fs 库。
import {ElectronService} from 'ngx-electron'
constructor(private _electronService: ElectronService) {
this.fs = this._electronService.remote.require('fs');
}
现在要让 ngx-electron 工作,我必须在 main.js 文件中设置以下内容:
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false
}
但是,当我这样做时,jquery 会停止在浏览器上加载(未定义 jquery)。如果没有这些 web 首选项,jquery 可以正常工作,但是 this._electronService.remote 返回 null。如何让 Jquery 和 fs (ngx-electron) 同时工作?
【问题讨论】:
标签: javascript node.js angular electron