28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
@page "/Test"
|
|
@using Majorsoft.Blazor.Components.Debounce
|
|
|
|
<h3>Test</h3>
|
|
|
|
<DebounceInput id="in1" class="form-control w-100" placeholder="@("Digitare almeno " + _minCharsLength + " caratteri")" autocomplete="off"
|
|
@ref="input1"
|
|
@bind-Value="@_debounceInputValue" @bind-Value:event="OnInput"
|
|
DebounceTime="@_debounceMilisec"
|
|
MinLength="@_minCharsLength"
|
|
OnValueChanged="e => { _notifiedInputValue = e; }"
|
|
ForceNotifyByEnter="@_forceNotifyByEnter"
|
|
ForceNotifyOnBlur="@_forceNotifyOnBlur" />
|
|
|
|
<div>Notified value: @_notifiedInputValue</div>
|
|
<div>Actual value: @_debounceInputValue</div>
|
|
<input type="button" class="btn btn-primary" value="Read out actual value" @onclick="(_ => { _debounceInputValue = input1.Value; })" />
|
|
|
|
@code {
|
|
//DebounceInput
|
|
private string _debounceInputValue = "";
|
|
private string _notifiedInputValue = "";
|
|
private int _debounceMilisec = 200;
|
|
private int _minCharsLength = 2;
|
|
private bool _forceNotifyByEnter = true;
|
|
private bool _forceNotifyOnBlur = true;
|
|
private DebounceInput input1;
|
|
} |