通过设置 DialogOption
IsKeyboard
参数,开启弹窗是否支持 ESC,请点击后面按钮设置后再点击 弹窗 按钮测试效果
@@ -100,6 +92,35 @@
+
+ 功能介绍
+
+ - 点击按钮弹出编辑弹窗
+ - 通过
EditDialogOption
参数对弹窗进行设置
+ - 设计出发点通过给定
Model
或者 Items
自动生成带客户端验证的表单窗口
+
+
+
+
+
+ 功能介绍
+
+ - 点击按钮弹出搜索弹窗
+ - 通过
SearchDialogOption
参数对弹窗进行设置
+ - 设计出发点通过给定
Model
或者 Items
自动生成搜索窗口
+
+
+
+
+
+ 功能介绍
+
+ - 点击按钮弹出保存弹窗
+ - 设计出发点通过给定
TComponent
自动生成保存窗口,通过设置 saveCallback
在保存回调方法中进行数据处理,TComponent
泛型组件所需要参数可以通过 parameters
进行传递
+
+
+
+
diff --git a/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs b/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs
index 373fc65b0..a5e2de209 100644
--- a/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs
+++ b/src/BootstrapBlazor.Shared/Samples/Dialogs.razor.cs
@@ -7,6 +7,7 @@ using BootstrapBlazor.Shared.Common;
using BootstrapBlazor.Shared.Components;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
+using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -29,6 +30,10 @@ public sealed partial class Dialogs
[NotNull]
private DialogService? DialogService { get; set; }
+ [Inject]
+ [NotNull]
+ private IStringLocalizer
? Localizer { get; set; }
+
private bool IsKeyboard { get; set; }
private void OnClickKeyboard()
@@ -224,6 +229,44 @@ public sealed partial class Dialogs
});
}
+ private async Task OnEditDialogClick()
+ {
+ var option = new EditDialogOption()
+ {
+ Title = "编辑弹窗",
+ Model = new Foo(),
+ RowType = RowType.Inline,
+ ItemsPerRow = 2,
+ ItemChangedType = ItemChangedType.Update
+ };
+ await DialogService.ShowEditDialog(option);
+ }
+
+ private async Task OnSearchDialogClick()
+ {
+ var option = new SearchDialogOption()
+ {
+ Title = "搜索弹窗",
+ Model = new Foo(),
+ RowType = RowType.Inline,
+ ItemsPerRow = 2,
+ };
+ await DialogService.ShowSearchDialog(option);
+ }
+
+ private async Task OnSaveDialogClick()
+ {
+ var foo = Foo.Generate(Localizer);
+ await DialogService.ShowSaveDialog("保存", () =>
+ {
+ // 此处可以访问 foo 实例进行入库操作等
+ return Task.FromResult(true);
+ }, new Dictionary
+ {
+ ["Value"] = foo
+ });
+ }
+
///
/// 获得属性方法
///