【发布时间】:2019-05-23 11:46:22
【问题描述】:
如何在 Blazor 上使用 c# 代码制作 window.history.go(-1)?
我尝试使用 JSRuntime.Current.InvokeAsync
JSRuntime.Current.InvokeAsync< string >( "history.go", new[] {-1} );
JSRuntime.Current.InvokeAsync< string >( "top.history.go", new[] {-1} );
JSRuntime.Current.InvokeAsync< string >( "window.history.go", new[] {-1} );
JSRuntime.Current.InvokeAsync< string >( "window.top.history.go", new[] {-1} );
但我收到错误:调用未实现接口 History 的对象。
但它可以从 cshtml 工作:
<button id="BtnBack" type="button" onclick="window.history.go(-1)" class="btn btn-default">Back</button>
【问题讨论】:
-
对 InvokeAsync 的四次调用是否出现相同的错误?
标签: blazor