@page "/" @Count 增加 @code { private int Count { get; set; } = 0; private void IncrementCount() { Count++; // Without StateHasChanged(), the component will not be re-rendered. StateHasChanged(); } }
@code { private int Count { get; set; } = 0; } @Count @code { [Parameter] public int Count { get; set; } [Parameter] public EventCallback CountChanged { get; set; } private void IncrementCount() { Count++; CountChanged.InvokeAsync(Count); } }
上一篇:Blazor服务器自包含应用程序的IIS输出缓存
下一篇:Blazor服务器,Router组件的附加程序集不遵循 @page 声明。