采用以下模式:
public class LoginVM
{
// ...
[Required]
public string? Password { get; set; }
}以及以下HTML:
<EditForm Model="@model" OnValidSubmit="@Submit">
...
<MudTextField T="string?" For="@(() => model.Password)" @bind-Value="model.Password"
Label="Password" Variant="Variant.Outlined" InputType="@PasswordInput"
Adornment="Adornment.End" AdornmentIcon="@PasswordInputIcon"
OnAdornmentClick="TogglePasswordBox" />
...
</EditForm>我得到了以下UI:

我如何隐藏错误信息,只保留可视的红色边框和标签?
发布于 2022-08-16 17:28:48
这就足够了:
[Required(ErrorMessage = " ")]
public string? Password { get; set; }重要的是:"“,而不仅仅是”。
https://stackoverflow.com/questions/73377534
复制相似问题