diff --git a/src/BootstrapBlazor.Server/Components/Samples/Responsives.razor b/src/BootstrapBlazor.Server/Components/Samples/Responsives.razor index 664d9b7f4b1..5e997cc31ab 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Responsives.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Responsives.razor @@ -4,9 +4,7 @@

@Localizer["ResponsiveTitle"]

@Localizer["ResponsiveDescription"]

- +
@Localizer["ResponsiveNormalIntroCurrentText"] Breakpoint:@Size
diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 89de8baf356..efd9c988bdb 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.0.7-beta02 + 8.0.7-beta03 diff --git a/src/BootstrapBlazor/Components/ResizeNotification/ResizeNotificationService.cs b/src/BootstrapBlazor/Components/ResizeNotification/ResizeNotificationService.cs index 1832dfe3f2c..55d3b4d4c90 100644 --- a/src/BootstrapBlazor/Components/ResizeNotification/ResizeNotificationService.cs +++ b/src/BootstrapBlazor/Components/ResizeNotification/ResizeNotificationService.cs @@ -26,6 +26,11 @@ public class ResizeNotificationService /// public void Unsubscribe(object target) => Cache.TryRemove(target, out _); + /// + /// 获得 当前值 + /// + public BreakPoint CurrentValue { get; private set; } + /// /// 内部调用 /// @@ -33,6 +38,8 @@ public class ResizeNotificationService /// internal async Task InvokeAsync(BreakPoint breakPoint) { + CurrentValue = breakPoint; + foreach (var cb in Cache.Values) { await cb(breakPoint); diff --git a/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs b/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs index 4b711bbb5c2..6a8c16d485e 100644 --- a/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs +++ b/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs @@ -27,6 +27,22 @@ protected override void OnInitialized() ResizeService.Subscribe(this, OnResize); } + /// + /// + /// + /// + /// + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + if (OnBreakPointChanged != null) + { + await OnBreakPointChanged(ResizeService.CurrentValue); + } + } + } + /// /// 客户端通知断点已改变 ///