我在一个操作中使用了以下方法。
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("sample-data/weather.json");
await someOperation(); // this action is not perfomred
}关于此查询的任何建议
发布于 2020-07-08 06:55:07
我以前遇到过这个问题,我能够像这样解决它:
protected override async Task OnInitializedAsync()
{
Http.GetJsonAsync<WeatherForecast[]>("sample-data/weather.json").ContinueWith(task => forecasts = task.Result); //Creates a continuation that executes asynchronously when the target Task completes.
await someOperation(); // his action can also be done using ContinueWith if needed
}ContinueWith文档:
希望这能有所帮助。
https://stackoverflow.com/questions/59576210
复制相似问题