@{ var model = value as Dummy; // 此处也可以不使用 Context 值，直接使用模型 ValidateModel 即可 }
@code { private Dummy ValidateModel { get; set; } = new Dummy() { Name = "张三", Age = 23, BirthDay = new DateTime(1997, 12, 05), Education = EnumEducation.Middel }; public class Dummy { ///
/// ///
[Required(ErrorMessage = "姓名不可以为空")] [DisplayName("姓名")] [EditorOrder(1)] public string? Name { get; set; } ///
/// ///
[Required(ErrorMessage = "年龄不可以为空")] [DisplayName("年龄")] [EditorOrder(2)] public int Age { get; set; } ///
/// ///
[DisplayName("生日")] [EditorOrder(3)] public DateTime BirthDay { get; set; } = DateTime.Today.AddYears(-20); ///
/// ///
[Required(ErrorMessage = "请选择一种爱好")] [DisplayName("爱好")] [EditorOrder(5)] public IEnumerable Hobby { get; set; } = new List(); ///
/// ///
[Required(ErrorMessage = "请选择学历")] [DisplayName("学历")] [EditorOrder(4)] public EnumEducation? Education { get; set; } } }