« Blazor component » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
Aucun résumé des modifications
Ligne 3 : Ligne 3 :
<filebox fn='Components/MyComponent.razor'>
<filebox fn='Components/MyComponent.razor'>
<h1>Test</h1>
<h1>Test</h1>
<p>@ChildContent</p>
</filebox>
</filebox>


<filebox fn='Components/MyComponent.razor.cs'>
<filebox fn='Components/MyComponent.razor.cs'>
 
public partial class MyComponent : ComponentBase
{
    [Parameter]
    public RenderFragment ChildContent { get; set; }
}
</filebox>
</filebox>


Ligne 19 : Ligne 24 :
@using Component.Components
@using Component.Components


<MyComponent />
<MyComponent>
    test !!!
</MyComponent>
</filebox>
</filebox>


= Child content =
= Child content =

Version du 25 juillet 2021 à 09:24

Basic component

Components/MyComponent.razor
<h1>Test</h1>
<p>@ChildContent</p>
Components/MyComponent.razor.cs
public partial class MyComponent : ComponentBase
{
    [Parameter]
    public RenderFragment ChildContent { get; set; }
}
Components/MyComponent.razor.css
h1 {
    color: coral;
}
Pages/Index.razor
@page "/"
@using Component.Components

<MyComponent>
    test !!!
</MyComponent>

Child content