【发布时间】:2020-12-24 22:35:20
【问题描述】:
我正在使用 fluent-design-system-provider 评估新的 Microsoft fast.design https://www.fast.design/ 并尝试为 Blazor 项目自定义强调色,但没有运气...
这是我按照官方文档 (https://www.fast.design/docs/design-systems/fast-frame) 所做的:
在我的 asp.net 核心 Blazor 服务器项目的 _Host.cshtml
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title </title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="Test.Main.styles.css" rel="stylesheet" />
</head>
<body>
<fluent-design-system-provider use-defaults>
<component type="typeof(App)" render-mode="ServerPrerendered" />
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">????</a>
</div>
</fluent-design-system-provider>
<script src="_framework/blazor.server.js"></script>
<script type="module" src="https://unpkg.com/@@microsoft/fast-components"></script>
<script type="module" src="https://unpkg.com/@@fluentui/web-components"></script>
<script type="module" src="~/script/site.js"></script>
</body>
</html>
在我的 site.js 之后,我正在尝试生成和替换文档https://www.fast.design/docs/design-systems/fast-frame#generating-and-replacing-palettes
中提到的调色板import { parseColorHexRGB } from "@microsoft/fast-colors";
import { createColorPalette } from "@microsoft/fast-components";
// Initialization
(function () {
const palette = createColorPalette(parseColorHexRGB("#28EBD7"));
const provider = document.querySelector("fluent-design-system-provider");
// change the neutral color pallete
provider.neutralPalette = palette;
})();
我收到以下错误, 未捕获的类型错误:无法解析模块说明符“@microsoft/fast-colors”。相对引用必须以“/”、“./”或“../”开头。
我该如何解决这个问题?
【问题讨论】:
标签: asp.net-core blazor fluent-ui