问题
How to set value from childcontent property
index.razor
<ButtonName>Submit</ButtonName>
ButtonName.razor
<input type="radio" value=@childContent>
<label> @childContent </label>
回答1:
You should define a parameter property named ChildContent in ButtonName.razor, like this:
[Parameter]
public RenderFragment ChildContent { get; set; }
And use it like this:
<input type="radio" value=@ChildContent>
<label> @ChildContent </label>
Note that ChildContent contains initial capital letter C
来源:https://stackoverflow.com/questions/64715699/blazor-how-to-set-value-from-childcontent-property