我是 ASP.NET Core 的新手。使用视图组件时出现此错误。谢谢您的帮助
InvalidOperationException:视图组件“UI.ViewComponents.NavbarViewComponent”的方法“Invoke”无法返回任务。
这是我的代码
public async Task<IViewComponentResult> Invoke()
{
var settings = await _db.Settings.ToListAsync();
return View(settings);
}
并认为:
@await Component.InvokeAsync("Navbar")