diff --git a/BlazorSharedDemo.SharedUI/Global/AppConst.cs b/BlazorSharedDemo.SharedUI/Global/AppConst.cs deleted file mode 100644 index da8ce3c..0000000 --- a/BlazorSharedDemo.SharedUI/Global/AppConst.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace BlazorSharedDemo.SharedUI; - -public class AppConst -{ - public const string UiWebRoot = "_content/BlazorSharedDemo.SharedUI"; -} diff --git a/BlazorSharedDemo.SharedUI/Global/AppGlobal.cs b/BlazorSharedDemo.SharedUI/Global/AppGlobal.cs new file mode 100644 index 0000000..acece60 --- /dev/null +++ b/BlazorSharedDemo.SharedUI/Global/AppGlobal.cs @@ -0,0 +1,6 @@ +namespace BlazorSharedDemo.SharedUI; + +public class AppGlobal +{ + public static readonly string UiWebRoot = $"_content/{typeof(AppGlobal).Assembly.GetName().Name}"; +} diff --git a/BlazorSharedDemo.SharedUI/Shared/MainLayout.razor b/BlazorSharedDemo.SharedUI/Shared/MainLayout.razor index ea94a1c..7831849 100644 --- a/BlazorSharedDemo.SharedUI/Shared/MainLayout.razor +++ b/BlazorSharedDemo.SharedUI/Shared/MainLayout.razor @@ -1,9 +1,10 @@ @namespace BlazorSharedDemo.SharedUI @inherits LayoutComponentBase <HeadContent> - <link rel="stylesheet" href="@AppConst.UiWebRoot/css/SharedUI.css" /> + <link rel="stylesheet" href="@AppGlobal.UiWebRoot/css/SharedUI.css" /> </HeadContent> <main> + <div>@AppGlobal.UiWebRoot</div> @Body </main> diff --git a/BlazorSharedDemo.SharedUI/Shared/MyImage.razor b/BlazorSharedDemo.SharedUI/Shared/MyImage.razor index bea9c54..e537433 100644 --- a/BlazorSharedDemo.SharedUI/Shared/MyImage.razor +++ b/BlazorSharedDemo.SharedUI/Shared/MyImage.razor @@ -1,19 +1,19 @@ <div> <ul> <li> - <img src="_content/BlazorSharedDemo.SharedUI/images/01.jpg" alt="" /> + <img src="@AppGlobal.UiWebRoot/images/01.jpg" alt="" /> </li> <li> - <img src="_content/BlazorSharedDemo.SharedUI/images/02.jpg" alt="" /> + <img src="_@AppGlobal.UiWebRoot/images/02.jpg" alt="" /> </li> <li> - <img src="_content/BlazorSharedDemo.SharedUI/images/03.jpg" alt="" /> + <img src="@AppGlobal.UiWebRoot/images/03.jpg" alt="" /> </li> <li> - <img src="_content/BlazorSharedDemo.SharedUI/images/04.jpg" alt="" /> + <img src="@AppGlobal.UiWebRoot/images/04.jpg" alt="" /> </li> <li> - <img src="_content/BlazorSharedDemo.SharedUI/images/05.jpg" alt="" /> + <img src="@AppGlobal.UiWebRoot/images/05.jpg" alt="" /> </li> </ul>