Die*_*ter 5 asp.net-core blazor blazor-server-side
我在 Blazor 应用程序中使用该标签。但是如何使用我自己的文化来格式化日期?
<InputDate class="form-control" @bind-Value="@ValidDate" @bind-Value:culture="nl-BE" @bind-Value:format="dd/MM/yyyy" />
Run Code Online (Sandbox Code Playgroud)
问候迪特
答案是@bind-Value:format,像这样
@page "/"
<EditForm Model="@CurrentPerson">
<InputDate @bind-Value="@CurrentPerson.DateOfBirth" @bind-Value:format="dd/MM/yyyy"/>
</EditForm>
@code
{
Person CurrentPerson = new Person();
public class Person
{
public DateTime DateOfBirth { get; set; } = DateTime.Now;
}
}
Run Code Online (Sandbox Code Playgroud)
还可以选择使用bind-Value:culture.
| 归档时间: |
|
| 查看次数: |
5833 次 |
| 最近记录: |