From fafc756b6d86812ea338319bc128078490fe5ed6 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:01:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20IRootComponent?= =?UTF-8?q?Generator=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseComponents/BootstrapBlazorRoot.razor | 5 +++++ .../BaseComponents/BootstrapBlazorRoot.razor.cs | 3 +++ .../Services/IRootComponentGenerator.cs | 17 +++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/BootstrapBlazor/Services/IRootComponentGenerator.cs diff --git a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor index 8ebdfdac9db..71240638706 100644 --- a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor +++ b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor @@ -17,6 +17,11 @@ +@foreach(var com in Generators) +{ + @com.Generator() +} + @code { RenderFragment RenderChildContent => @ diff --git a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs index 90f919f8f57..7aff0546775 100644 --- a/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs +++ b/src/BootstrapBlazor/Components/BaseComponents/BootstrapBlazorRoot.razor.cs @@ -19,6 +19,9 @@ public partial class BootstrapBlazorRoot [NotNull] private IOptionsMonitor? Options { get; set; } + [Inject, NotNull] + private IEnumerable? Generators { get; set; } + /// /// 获得/设置 子组件 /// diff --git a/src/BootstrapBlazor/Services/IRootComponentGenerator.cs b/src/BootstrapBlazor/Services/IRootComponentGenerator.cs new file mode 100644 index 00000000000..4fe99966aa9 --- /dev/null +++ b/src/BootstrapBlazor/Services/IRootComponentGenerator.cs @@ -0,0 +1,17 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +/// +/// 根组件接口 +/// +public interface IRootComponentGenerator +{ + /// + /// 生成组件方法 + /// + /// + RenderFragment Generator(); +} From 89ad66e7342ac51cc792fdaaf636dc6794d6968c Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 22 Aug 2024 20:03:58 +0800 Subject: [PATCH 2/2] chore: bump version 8.8.4-beta06 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index fbf39772fda..35583c70ab0 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.8.4-beta05 + 8.8.4-beta06