아래 코드 블록은 Blazor 문서입니다. 그러나 '텍스트'경로 매개 변수가 Text 속성에 값을 할당하는 방법과 기준을 알 수 없습니다.
@page "/RouteParameter"
@page "/RouteParameter/{text}"
<h1>Blazor is @Text!</h1>
@code {
[Parameter]
public string Text { get; set; }
protected override void OnInitialized()
{
Text = Text ?? "fantastic";
}
}
Blazor는 단어의 대소 문자를 무시하여 경로 매개 변수를 속성과 일치시킵니다.
Blazor는 경로에서 모든 매개 변수를 가져오고 클래스에서 모든 속성을 가져와 케이스를 무시하고 할당합니다.
따라서 소문자 text
는 Text
.
이것은 또한 작동합니다
@page "/RouteParameter"
@page "/RouteParameter/{Text}" // upper case Text
<h1>Blazor is @Text!</h1>
@code {
[Parameter]
public string Text { get; set; }
protected override void OnInitialized()
{
Text = Text ?? "fantastic";
}
}
그러나 일반적으로 URL에는 대문자가없고 C # 속성은 대문자로 시작하기 때문에이 비교는 대소 문자를 무시할 수 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다