我在浏览器中收到以下错误:
Cannot provide a value for property 'IconService' on type 'Microsoft.Fast.Components.FluentUI.FluentIcon'. There is no registered service of type 'Microsoft.Fast.Components.FluentUI.IconService'.https://learn.microsoft.com/en-us/fluent-ui/web-components/components/button?pivots=blazor
https://brave-cliff-0c0c93310.azurestaticapps.net/ButtonPage
当使用Microsoft Blazor的示例代码时,如下所示:
<h3>With content and icon</h3>
<h4>With start</h4>
<FluentButton>
Button
<FluentIcon Name="@FluentIcons.Globe" Slot="start" Size="@IconSize.Size16" Filled=false />
</FluentButton>一个按钮呈现得很好,但是当我使用FluentIcon时,我会得到一个运行时错误。
我遵循了这个入门指南:
https://learn.microsoft.com/en-us/fluent-ui/web-components/integrations/blazor
我也看过图标的例子,但运气不佳:
发布于 2022-09-02 14:29:43
您需要为您的Blazor客户端将下面的代码添加到Program.cs中。出于某种原因,这只记录在Github上,而不是https://learn.microsoft.com上。
builder.Services.AddFluentUIComponents();https://stackoverflow.com/questions/73584115
复制相似问题