parent
28afaa6d81
commit
999f676d98
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,9 @@
|
||||
@page "/parameter-parent"
|
||||
|
||||
<h1>Child component (without attribute values)</h1>
|
||||
|
||||
<ParameterChild />
|
||||
|
||||
<h1>Child component (with attribute values)</h1>
|
||||
|
||||
<ParameterChild Title="Set by Parent" Body="@(new PanelBody() { Text = "Set by parent.", Style = "italic" })" />
|
@ -0,0 +1,24 @@
|
||||
@page "/parameter-parent-2"
|
||||
|
||||
<ParameterChild Title="@title" />
|
||||
|
||||
<ParameterChild Title="@GetTitle()" />
|
||||
|
||||
<ParameterChild Title="@DateTime.Now.ToLongDateString()" />
|
||||
|
||||
<ParameterChild Title="@panelData.Title" />
|
||||
|
||||
@code {
|
||||
private string title = "From Parent field";
|
||||
private PanelData panelData = new();
|
||||
|
||||
private string GetTitle()
|
||||
{
|
||||
return "From Parent method";
|
||||
}
|
||||
|
||||
private class PanelData
|
||||
{
|
||||
public string Title { get; set; } = "From Parent object";
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
@page "/parameter-parent-3"
|
||||
|
||||
<ParameterChild Title="@GetTitle()" />
|
||||
|
||||
@code {
|
||||
private PanelData panelData = new();
|
||||
|
||||
private string GetTitle() => $"Set by {panelData.Title}";
|
||||
|
||||
private class PanelData
|
||||
{
|
||||
public string Title { get; set; } = "Parent";
|
||||
}
|
||||
}
|
@ -1,8 +1,13 @@
|
||||
@page "/RouteParameter/{text}"
|
||||
@page "/RouteParameter/{text?}"
|
||||
|
||||
<h1>Blazor is @Text!</h1>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string? Text { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Text = Text ?? "fantastic";
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
@page "/user/{Id:int}/{Option:bool?}"
|
||||
|
||||
<p>
|
||||
Id: @Id
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Option: @Option
|
||||
</p>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool Option { get; set; }
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<div class="card w-25" style="margin-bottom:15px">
|
||||
<div class="card-header font-weight-bold">@Title</div>
|
||||
<div class="card-body" style="font-style:@Body.Style">
|
||||
@Body.Text
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string Title { get; set; } = "Set By Child";
|
||||
|
||||
[Parameter]
|
||||
public PanelBody Body { get; set; } =
|
||||
new()
|
||||
{
|
||||
Text = "Set by child.",
|
||||
Style = "normal"
|
||||
};
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
c0feac9b06aeb07d0970069a084861810e18935f
|
||||
dfc017db507c3ed1e12a2d1aa2afd2f86d901ced
|
||||
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue