Javascript angular electron WebView未加载网站的所有功能
我正在尝试在我的桌面应用程序中使用WebView(它是通过选择Angular构建的)。当我加载窗口时,我能够呈现WebView,但在登录到网站的WebView内容后,所有其他剩余功能都不起作用 注:该网站是使用thymeleaf开发的 我试过如下:Javascript angular electron WebView未加载网站的所有功能,javascript,angular,webview,electron,Javascript,Angular,Webview,Electron,我正在尝试在我的桌面应用程序中使用WebView(它是通过选择Angular构建的)。当我加载窗口时,我能够呈现WebView,但在登录到网站的WebView内容后,所有其他剩余功能都不起作用 注:该网站是使用thymeleaf开发的 我试过如下: <webview id="mainwebview" nodeintegration='on' src="https://tarc-uat.gfcp.io/" style=" width:100%; height:calc(100vh - 1
<webview id="mainwebview" nodeintegration='on' src="https://tarc-uat.gfcp.io/"
style=" width:100%; height:calc(100vh - 11vw)" partition="persist:sitesession" disablewebsecurity="on" webpreferences="allowRunningInsecureContent" >
<div class="indicator"> </div>
</webview>
经过所有可爱的斗争,我找到了解决方案,这对我来说很好,所有的功能在网站上都很好。 下面是解决方案
然后从角度组件加载url,如下所示
export class WebviewComponent implements OnInit {
public url = 'https://tarc-uat.gfcp.io/';
constructor() { }
ngOnInit() {
}
}
import { NgModule, ErrorHandler,NO_ERRORS_SCHEMA } from '@angular/core';
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA
]
注意:在此之前,您需要在angular app.module中导入“NO_ERRORS_SCHEMA”,以支持webview元素并在@NgModule模式下导入,如下所示
export class WebviewComponent implements OnInit {
public url = 'https://tarc-uat.gfcp.io/';
constructor() { }
ngOnInit() {
}
}
import { NgModule, ErrorHandler,NO_ERRORS_SCHEMA } from '@angular/core';
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA
]
就是这样,如果您遵循这一点,就不需要onload脚本