Как получить события, запускаемые в компоненте Razor, работающем на странице Razor?
Мой запуск:
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
endpoints.MapBlazorHub();
});
}
Моя страница Razor, вызывающая компонент:
@page
@model DocketDetail.OrderModel
@{
Layout = null;
}
@using RelationalObjectLayerCore;
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<script src="~/lib/jquery/dist/jquery.js"></script>
<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="_framework/blazor.server.js"></script>
<script src="~/js/site.js"></script>
<title>Order</title>
</head>
<body>
<component type="typeof(Component.Filedby)" render-mode="ServerPrerendered" />
</body>
Все отображается правильно.
Мой компонент:
@using Microsoft.AspNetCore.Components
@code {
private void SearchPerson()
{
string x = "TEST";
}
}
<button @onclick="SearchPerson">Search</button>
Очевидно, что это сравнено с моим реальным кодом ... но я не могу понять, как получить "SearchPerson" стрелять в компоненте бритвы.