์๋ ํ์ธ์. ์ฐจํธ ๊ธฐ๋ฅ์ด ํ์ํด์ ์ฐพ์๋ณด๋ค blazor bootstrap์ด ์๋ค๋๊ฑธ ์์์ต๋๋ค.
ํจํค์ง๋ฅผ ์ค์นํ์ฌ ํ ์คํธ๋ฅผ ํ๋๋ฐ
์ฌ์ดํธ ์์ ๋๋ก MainLayout๋ฅผ ์์ ํ๊ณ ์ ๊ท ๋ ์ด์ ํ์ผ์ ๋ง๋ค์ด ๋ฑ๋กํ๊ณ ํ ์คํธ๋ฅผ ํ๋ฉด 404 ์๋ฌ๊ฐ ์ผ์ด๋ฉ๋๋ค.
NavMenu๋ฅผ ์ด์ฉํ์ง ์๋๊ฑฐ ๊ฐ์๋ฐ ํด๋น ๊ฒฝ๋ก๋ฅผ ์ถ๊ฐ๋ฅผ ํด๋ ๋ง์ฐฌ๊ฐ์ง๋ก 404์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค.
์ ๊ท ์ถ๊ฐ๋ page ์ด๋ฆ์ด ์ ๋๋ก ๋ก๋๊ฐ ์๋๋๊ฑฐ ๊ฐ์๋ฐ ์์๋๋ถ ๊ณ์ค๊น์??
Blazor Bootstrap MainLayout
@inherits LayoutComponentBase
<div class="bb-page">
<Sidebar @ref="sidebar"
IconName="IconName.BootstrapFill"
Title="Blazor Bootstrap"
DataProvider="SidebarDataProvider" />
<main>
<div class="bb-top-row px-4 d-flex justify-content-end">
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>
<article class="content px-4">
<div class="py-2">@Body</div>
</article>
</main>
</div>
@code {
Sidebar sidebar;
IEnumerable<NavItem> navItems;
private async Task<SidebarDataProviderResult> SidebarDataProvider(SidebarDataProviderRequest request)
{
if (navItems is null)
navItems = GetNavItems();
return await Task.FromResult(request.ApplyTo(navItems));
}
private IEnumerable<NavItem> GetNavItems()
{
navItems = new List<NavItem>
{
new NavItem { Id = "1", Href = "/", IconName = IconName.HouseDoorFill, Text = "Home", Match=NavLinkMatch.All},
new NavItem { Id = "2", Href = "/counter", IconName = IconName.PlusSquareFill, Text = "Counter"},
new NavItem { Id = "3", Href = "/weather", IconName = IconName.Table, Text = "Fetch Data"},
new NavItem { Id = "4", Href = "/attendance", IconName = IconName.Table, Text = "Attendance" } ,
new NavItem { Id = "5", Href = "/component", IconName = IconName.Table, Text = "NEW" } ,
new NavItem { Id = "6", Href = "/summury", IconName = IconName.Table, Text = "Summury" }
};
return navItems;
}
}
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">๐</a>
</div>
Summury๋ผ๋ ํ์ด์ง๋ฅผ ๋ง๋ค์๊ณ ๋ฉ์ธ๋ ์ด์์์ ์ค์ ํ์ต๋๋ค.
Summury ํ์ด์ง๋ ํ
์ค๋ง ์๋ ๋จ์ํ์ด์ง ์ด๊ณ ๋ฉ์ธ๋ ์ด์์์์ summury๋งํฌ๋ฅผ ํด๋ฆญํ๋ฉด ํ๋ผ๋ฉํฐ ์ค์ ์ ํ์ง ์์๋๋ฐ url์ localhost:7000/summury? ๋ก ๋์ด๊ฐ๋ค์;;