diff --git a/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor b/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor
index b50651db8..81ffadab8 100644
--- a/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor
+++ b/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor
@@ -7,13 +7,17 @@
EditDialog
组件是 Dialog
组件的扩展,适用于数据弹出窗编辑。
- 通过调用注入服务 DialogService
的 ShowEditDialog
方法直接弹出编辑对话框,大大减少代码量。EditDialogOption
配置类继承 DialogOption
,更多参数设置请点击 [传送门]
+ 通过调用注入服务 DialogService
的 ShowEditDialog
方法直接弹出编辑对话框,大大减少代码量。EditDialogOption
配置类继承 DialogOption
,更多参数设置请点击 [传送门]
-
-
-
+
+
+
+
+
+
+
diff --git a/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor.cs b/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor.cs
index 0702e0c0c..4d544084d 100644
--- a/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor.cs
+++ b/src/BootstrapBlazor.Shared/Pages/Samples/EditDialogs.razor.cs
@@ -93,6 +93,40 @@ namespace BootstrapBlazor.Shared.Pages
await DialogService.ShowEditDialog(option);
}
+ private async Task ShowEditDialog()
+ {
+ var items = EditorItem.GenerateEditorItems();
+ var item = items.First(i => i.GetFieldName() == nameof(Foo.Hobby));
+ item.Data = Foo.GenerateHobbys(Localizer);
+
+ // 设置 地址与数量 不可编辑
+ item = items.First(i => i.GetFieldName() == nameof(Foo.Address));
+ item.Editable = false;
+ item = items.First(i => i.GetFieldName() == nameof(Foo.Count));
+ item.Editable = false;
+
+ var option = new EditDialogOption()
+ {
+ Title = "编辑对话框",
+ Model = Model,
+ Items = items,
+ ItemsPerRow = 2,
+ RowType = RowType.Inline,
+ OnCloseAsync = () =>
+ {
+ Trace.Log("关闭按钮被点击");
+ return Task.CompletedTask;
+ },
+ OnSaveAsync = context =>
+ {
+ Trace.Log("保存按钮被点击");
+ return Task.FromResult(true);
+ }
+ };
+
+ await DialogService.ShowEditDialog(option);
+ }
+
///
/// 获得属性方法
///
diff --git a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs
index 5b811fd28..85b103da5 100644
--- a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs
+++ b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs
@@ -180,7 +180,7 @@ namespace BootstrapBlazor.Components
if (CascadeEditorItems != null)
{
// 通过级联参数渲染组件
- FormItems.AddRange(CascadeEditorItems);
+ FormItems.AddRange(CascadeEditorItems.Where(i => i.Editable));
}
else
{