我正在尝试编写一个通过JSInterop使用Google地图的Blazor组件。我正在尝试调用“ DirectionsService”类和“ route”方法。DirectionsService Route Method
这是我的本地方法:
public async Task<DirectionResponse> Route(DirectionsRequest request)
{
var json = await _jsObjectRef.InvokeAsync<string>(
"google.maps.DirectionsService.route",request);
var directionResponse = JsonConvert.DeserializeObject<DirectionResponse>(json);
return directionResponse;
}
此方法有两个参数。一个是请求对象。第二个是回调函数。 Method Definition
如何使用“ InvokeAsync”方法完成此操作?
如何包含回调函数以便正确接收响应?