BootstrapBlazor - EditorForm 表单组件(一)
1.【转载】NETCore Bootstrap Admin 通用后台管理权限 [2]: Blazor 版本介绍2.【转载】开源 一套 Blazor Server 端精致套件3.【转载】Bootstrap Blazor 组件介绍 Table (一)自动生成列功能介绍4.【转载】Bootstrap Blazor 组件介绍 Table (二)自定义模板列功能介绍5.BootstrapBlazor 组件库介绍6.BootstrapBlazor 组件库使用体验---Table篇7.Bootstrap Blazor 使用模板创建项目8.BootstrapBlazor-Table9.BootstrapBlazor-ValidateForm 表单验证组件10.BootstrapBlazor 智能生成神器(一)AutoGenerateColumnAttribute 特性介绍
11.BootstrapBlazor - EditorForm 表单组件(一)
12.BootstrapBlazor--Input 组件13.BootstrapBlazor 模板安装14.【转载】Bootstrap Blazor 组件介绍 Table (三)列数据格式功能介绍15.BA & Blazor 技术交流群16.Bootstrap Blazor 开源UI库介绍-Table 虚拟滚动行17.Bootstrap Blazor AutoComplete 自动完成 组件18.Bootstrap Blazor Table 组件(四)自定义列生成19.Bootstrap Blazor Table 组件(三)智能生成20.Bootstrap Blazor 模板使用(一)Layout 组件21.Bootstrap Blazor Timer 计时器组件22.Bootstrap Blazor Cascader 级联选择组件23.Blazor 组件通讯24.Bootstrap Blazor 组件库 Row 布局组件(栅格系统)25.Bootstrap Blazor Table 组件(二)手动刷新组件数据26.Blazor 生命周期27.Bootstrap Blazor Modal 模态框组件28.Bootstrap Blazor 组件介绍原文链接:https://www.cnblogs.com/ysmc/p/16053652.html
官网例子链接:https://www.blazor.zone/editorforms
通过绑定数据模型自动呈现编辑表单
EditorForm
组件是一个非常实用的组件,当进行数据编辑时,仅需要将 Model
属性赋值即可。
- 绑定模型默认自动生成全部属性,可以通过设置
AutoGenerateAllItem
更改为不自动生成 - 如不需要编辑列,设置
Editable
即可,默认值为true
生成编辑组件 - 复杂编辑列,设置
EditTemplate
模板,进行自定义组件进行编辑 - 表单内按钮可以设置多个,设置
Buttons
模板即可
<EditorForm Model="@Model"> <FieldItems> <EditorItem @bind-Field="@context.Education" Editable="false" /> <EditorItem @bind-Field="@context.Complete" Editable="false" /> <EditorItem @bind-Field="@context.Hobby" Items="@Hobbys" /> </FieldItems> <Buttons> <Button Icon="fa fa-save" Text="提交" /> </Buttons> </EditorForm>
Attributes 属性
参数
|
说明
|
类型
|
可选值
|
默认值
|
---|---|---|---|---|
Model
|
当前绑定数据模型
|
TModel
|
—
|
—
|
FieldItems
|
绑定列模板
|
RenderFragment<TModel>
|
—
|
—
|
Buttons
|
按钮模板
|
RenderFragment
|
—
|
—
|
IsDisplay
|
是否显示为 Display 组件
|
bool
|
true/false
|
false
|
ShowLabel
|
是否显示 Label
|
bool
|
true/false
|
true
|
ShowLabelTooltip
|
鼠标悬停标签时显示完整信息
|
bool?
|
true/false/null
|
null
|
AutoGenerateAllItem
|
是否生成所有属性
|
bool
|
true/false
|
true
|
ItemsPerRow
|
每行显示组件数量
|
int?
|
—
|
—
|
RowType
|
设置组件布局方式
|
RowType
|
Row|Inline
|
Row
|
LabelAlign
|
Inline 布局模式下标签对齐方式
|
Alignment
|
None|Left|Center|Right
|
None
|
AttrAttributeTitle
参数
|
说明
|
类型
|
可选值
|
默认值
|
---|---|---|---|---|
Field
|
当前绑定数据值
|
TValue
|
—
|
—
|
FieldType
|
绑定列数据类型
|
Type
|
—
|
—
|
Editable
|
是否允许编辑
|
bool
|
true/false
|
true
|
Readonly
|
是否只读
|
bool
|
true/false
|
false
|
Text
|
编辑列前置标签名
|
string
|
—
|
—
|
EditTemplate
|
列编辑模板
|
RenderFragment<object>
|
—
|
—
|
本文来自博客园,作者:一事冇诚,转载请注明原文链接:https://www.cnblogs.com/ysmc/p/16053652.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战