38 lines
992 B
Plaintext
38 lines
992 B
Plaintext
<MudDialog>
|
|
<DialogContent>
|
|
<MudTextField @bind-Value="_value" Label="@Label" Required="true" Class="mb-3" />
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="Cancel">Cancel</MudButton>
|
|
<MudButton Color="Color.Primary" OnClick="Submit">Save</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code {
|
|
private string _value = string.Empty;
|
|
|
|
[Parameter] public string Title { get; set; } = string.Empty;
|
|
[Parameter] public string Label { get; set; } = string.Empty;
|
|
[Parameter] public string? Value { get; set; }
|
|
|
|
[CascadingParameter]
|
|
private IMudDialogInstance? MudDialog { get; set; }
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_value = Value ?? string.Empty;
|
|
}
|
|
|
|
private void Submit()
|
|
{
|
|
if (MudDialog != null && !string.IsNullOrWhiteSpace(_value))
|
|
{
|
|
MudDialog.Close(DialogResult.Ok(_value));
|
|
}
|
|
}
|
|
|
|
private void Cancel()
|
|
{
|
|
MudDialog?.Cancel();
|
|
}
|
|
} |