【问题标题】:dynamically render a blazor component next to App component在 App 组件旁边动态呈现 Blazor 组件
【发布时间】:2020-06-20 03:51:46
【问题描述】:

是否可以在 App 组件旁边动态呈现 Blazor 组件?这可能很疯狂,但我有一个要求,我必须在 Blazor 应用程序或正文元素的顶部旁边动态呈现一个组件。

<app>
   // Here my Blazor component needs to be rendered dynamically.
   // Rest of the other components rendering in a regular manner.
</app>

【问题讨论】:

    标签: components blazor blazor-server-side blazor-client-side


    【解决方案1】:

    我假设当您说动态时意味着您有不同的组件要在不同的场景中呈现。如果这是要求,那么您可以使用 if else 条件。您可以在 if 条件下使用代表您的场景#(s) 的变量。

    例子:

    <app>
    @if(scenario#1){
    <Component1/>
    }
    else if (scenario#2)
    {
    <Component2/>
    }
    else{
    <Component3/>
    }
    </app>
    

    【讨论】:

      猜你喜欢
      • 2020-01-04
      • 2020-11-04
      • 1970-01-01
      • 2020-07-17
      • 2020-01-30
      • 2021-04-01
      • 2021-11-08
      • 1970-01-01
      • 2018-09-24
      相关资源
      最近更新 更多