为什么 Mudblazor 组件出现时没有 css?
Why does Mudblazor component appear without css?
我已经通过 NuGet 安装了 mudblazor,并遵循了关于如何设置 mudblazor 的“教程”,我一步一步地完成了所有操作,但由于某种原因,该组件出现时没有任何 css 或 js。我必须 link css 和 _host.cshtml 中的 js 文件:
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
但问题是它似乎仍然不起作用。
尝试从 github、https://github.com/Garderoben/MudBlazor.Templates 克隆 MudBlazor 模板,它应该开箱即用,并安装了所有先决条件。如果不是,你的环境有问题
确保你设置你的 base href 如下:
<base href="/" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
在您的页面文件夹中创建一个名为 _Imports 的 Razor 组件并添加以下内容:@layout MainLayout
在您的 MainLayout 中,您应该有:
<MudThemeProvider/> <MudDialogProvider/> <MudSnackbarProvider/>
清空浏览器缓存并进行硬重新加载(在 Chrome 中按 F12,然后右键单击重新加载图标和 select“清空缓存并硬重新加载”)。这将在您的 Blazor WASM 客户端中加载新的客户端 css 和 js 内容。
我已经通过 NuGet 安装了 mudblazor,并遵循了关于如何设置 mudblazor 的“教程”,我一步一步地完成了所有操作,但由于某种原因,该组件出现时没有任何 css 或 js。我必须 link css 和 _host.cshtml 中的 js 文件:
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
但问题是它似乎仍然不起作用。
尝试从 github、https://github.com/Garderoben/MudBlazor.Templates 克隆 MudBlazor 模板,它应该开箱即用,并安装了所有先决条件。如果不是,你的环境有问题
确保你设置你的 base href 如下:
<base href="/" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
在您的页面文件夹中创建一个名为 _Imports 的 Razor 组件并添加以下内容:@layout MainLayout
在您的 MainLayout 中,您应该有:
<MudThemeProvider/> <MudDialogProvider/> <MudSnackbarProvider/>
清空浏览器缓存并进行硬重新加载(在 Chrome 中按 F12,然后右键单击重新加载图标和 select“清空缓存并硬重新加载”)。这将在您的 Blazor WASM 客户端中加载新的客户端 css 和 js 内容。