13,002
回編集
48行目: | 48行目: | ||
<br> | <br> | ||
==== App.razor ==== | ==== App.razor ==== | ||
Blazorアプリケーションのルートコンポーネントであり、ルーティングの設定等が含まれている。<br> | |||
<br> | <br> | ||
主な役割<br> | |||
* Router | |||
*: ルーティング設定の定義 | |||
* Found | |||
*: 有効なルートが見つかった場合の表示 | |||
* NotFound | |||
*: 無効なルートの場合の表示 | |||
*: 一般的には、MainLayoutをデフォルトレイアウトとして設定 | |||
<br> | |||
<syntaxhighlight lang="xml"> | |||
<Router AppAssembly="@typeof(Program).Assembly"> | |||
<Found Context="routeData"> | |||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | |||
</Found> | |||
<NotFound> | |||
<LayoutView Layout="@typeof(MainLayout)"> | |||
<p>Sorry, there's nothing at this address.</p> | |||
</LayoutView> | |||
</NotFound> | |||
</Router> | |||
</syntaxhighlight> | |||
<br> | |||
==== Program.cs ==== | ==== Program.cs ==== | ||
アプリケーションのエントリーポイントである。<br> | アプリケーションのエントリーポイントである。<br> |