设置控件输入焦点:
<FormItem Label="分类名称">
<AntDesign.Input @ref=@categoryTextRef @bind-Value=@context.Category />
</FormItem>
@code
{
AntDesign.Input<string> categoryTextRef;
protected override async Task OnInitializedAsync()
{
IsAdd = (id.HasValue && id.Value > 0) ? false : true;
if (IsAdd)
{//新添
model.SerialNumber = await GetMaxSerialNumberAsync();
await categoryTextRef.Focus(FocusBehavior.FocusAtFirst);
}
else
{//修改
var result = await Http.GetFromJsonAsync<NoteCategory> ($"NoteCategory/GetModel?ID={id}");
if (result != null)
{
model.ID = result.ID;
model.Category = result.Category;
model.SerialNumber = result.SerialNumber;
await categoryTextRef.Focus(FocusBehavior.FocusAndSelectAll);
}
}
}
}
表格绑定复合对象属性:
<Column TData="string" DataIndex="Plate.PlateName" Title="板块" Sortable />
NoticeWithIcon 通知提醒框:
找到App.razor组件,在最下面添加全局容器
<AntContainer />