> <div class=“行g-3”> <div class="col-sm-6"> <标签=“firstName” class=“form-label”>名字 > <div class="无效反馈"> 需要有效的名字。
P粉0326494132023-09-07 00:10:29
答案是添加 ValidationMessage
组件,如下所示:
<div class="col-sm-6"> <label for="firstName" class="form-label">First name</label> <InputText type="text" @bind-Value="CheckoutViewModel.FirstName" class="form-control" id="firstName" /> <ValidationMessage For="@(() => CheckoutViewModel.FirstName)" /> </div>