如何从 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} );
Run Code Online (Sandbox Code Playgroud)
但我收到错误:调用未实现接口历史记录的对象。
但它从 cshtml 工作:
<button id="BtnBack" type="button" onclick="window.history.go(-1)" class="btn btn-default">Back</button>
Run Code Online (Sandbox Code Playgroud) blazor ×1