我正在使用电子开发 angular 2 应用程序。这就是我想要做的。
我在 html 中有一个下一个按钮
<button (click) = nextButtonClickedHandler()>
将nextButtonClickedHandler被描述为如下:
public nextButtonClickedHandler() {
this.requestElectronMainProccess(this.afterResponseReceived);
}
private public afterResponseReceived() {
this._router.navigate(['/next', 'route']);
}
public requestElectronMainProccess(callbackFn: Function) {
this._electronService.send('request', 'some data');
this._electronService.once('response', callbackFn);
}
Run Code Online (Sandbox Code Playgroud)
所以,在这里,控制台上的事件日志_router.navigate说
我还添加了一个控制台语句来查看承诺返回的内容。
this._router.navigate(['/next', 'route']).then(
success => console.log('navigation success');
failure => console.log('navigation end');
);
Run Code Online (Sandbox Code Playgroud)
它打印“导航成功”。但是,该组件不会加载。不知道发生了什么。任何帮助是极大的赞赏。
注意:如果不涉及电子,则不会发生这种情况。例如下面的代码工作得很好
public nextButtonClickedHandler() {
this._router.navigate(['/next', 'route']);
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Qt中实现网页的显示。我选择使用Qt WebEngine来完成任务。这是我所做的:
在我的代码中,它看起来像这样:
View = new QWebEngineView(this);
// read the js file using qfile
file.open("path to jsFile");
myJsApi = file.Readall();
View->page()->runjavascript (myjsapi);
View->page()->runjavascript ("createRadioButton(\"button1\");");
Run Code Online (Sandbox Code Playgroud)
我发现该runJavaScript()功能对网页没有影响。我可以在输出窗口中看到该网页,但是我期望的单选按钮不存在。我究竟做错了什么?