| 123456789101112131415161718192021222324252627282930 |
- <p>Increment amount: @IncrementAmount</p>
- <p>Interactive: <span id="is-interactive-@IdSuffix">@_isInteractive</span></p>
- <p>Current count: <span id="count-@IdSuffix">@_currentCount</span></p>
- <button id="increment-@IdSuffix" @onclick="IncrementCount">Click me</button>
- @code {
- private int _currentCount = 0;
- private bool _isInteractive = false;
- [Parameter, EditorRequired]
- public int IncrementAmount { get; set; }
- [Parameter, EditorRequired]
- public string IdSuffix { get; set; }
- private void IncrementCount()
- {
- _currentCount += IncrementAmount;
- }
- protected override void OnAfterRender(bool firstRender)
- {
- if (firstRender)
- {
- _isInteractive = true;
- StateHasChanged();
- }
- }
- }
|