Blazor-将参数传递到自定义布局

时间:2020-02-14 09:23:13

标签: blazor blazor-server-side

如何将参数传递到自定义布局?

在单击NavLink时,自定义布局将显示在“ MainLayout”内部。

在“ MainLayout”中,我们添加了一个“自定义布局”作为嵌套元素,我们希望将参数从MainLayout传递到“自定义布局”。

已更新:

CustomLayout页面:

@layout MSLayout
@inherits LayoutComponentBase

<section id="Content-nested">
    <div>
        @Body
    </div>
</section>

在这里,我们要将一些值从MSLayout传递到CustomLayout

CustomLayout将在另一个组件中使用:

@layout CustomLayout
@page "/NestedComponent"

<h1>This component is in 'Nested layout!!!'</h1>

0 个答案:

没有答案