Blazor常用事件

一、Input事件:

<h1>Bind Event Example</h1>

<p>
<label>
InputValue:
<input @bind="InputValue" @bind:event="oninput" />
</label>

</p>

<p>
<code>InputValue</code>: @InputValue
</p>

@code {
private string? InputValue { get; set; }
}

二、OnChange事件

<p>
<label>
Normal Blazor binding:
<input @bind="InputValue" />
</label>
</p>

<p>
<label>
Demonstration of equivalent HTML binding:
<input value="@InputValue"
@onchange="@((ChangeEventArgs e) => InputValue =e?.Value?.ToString())" />
</label>
</p>

<p>
<code>InputValue</code>: @InputValue
</p>

@code {
private string? InputValue { get; set; }
}

posted @ 2024-03-03 09:45  Biyuanguang  阅读(32)  评论(0编辑  收藏  举报