mirror of https://github.com/abpframework/abp.git
Browse Source
Introduce dynamic components for Blazor and update the basic-theme layoutpull/13278/head
committed by
GitHub
4 changed files with 39 additions and 2 deletions
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Components.Web.Theming; |
||||
|
|
||||
|
public class AbpDynamicLayoutComponentOptions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Used to define components that renders in the layout
|
||||
|
/// </summary>
|
||||
|
[NotNull] |
||||
|
public Dictionary<Type, IDictionary<string,object>?> Components { get; set; } |
||||
|
|
||||
|
public AbpDynamicLayoutComponentOptions() |
||||
|
{ |
||||
|
Components = new Dictionary<Type, IDictionary<string, object>?>(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
@if (AbpDynamicLayoutComponentOptions.Value.Components.Any()) |
||||
|
{ |
||||
|
foreach (var (componentType, parameters) in AbpDynamicLayoutComponentOptions.Value.Components) |
||||
|
{ |
||||
|
<DynamicComponent Type="@componentType" Parameters="@parameters" /> |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using Microsoft.AspNetCore.Components; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Components; |
||||
|
|
||||
|
public partial class DynamicLayoutComponent : ComponentBase |
||||
|
{ |
||||
|
[Inject] |
||||
|
protected IOptions<AbpDynamicLayoutComponentOptions> AbpDynamicLayoutComponentOptions { get; set; } |
||||
|
} |
||||
Loading…
Reference in new issue