简体   繁体   English

.NET MAUI Blazor 混合本地图像未加载

[英].NET MAUI Blazor Hybrid local images not loading

Working on a .NET MAUI Blazor Hybrid and using MudBlazor for my UI.在 .NET MAUI Blazor Hybrid 上工作,并将 MudBlazor 用于我的 UI。 Images are currently not loading in my app.图片目前没有加载到我的应用程序中。 I have the following declared in the project file:我在项目文件中声明了以下内容:

<!-- Images -->
<MauiImage Include="Resources\Images\*" />

Example call in the razor UI: razor UI 中的示例调用:

<MudAvatar Image="resources/images/foo.jpeg" Size="Size.Large" />

I should also mention if I call an external image in the razor UI it works.我还应该提到,如果我在 razor 用户界面中调用外部图像,它会起作用。 Following example image loads without any issues:以下示例图像加载没有任何问题:

<MudAvatar Image="https://pbs.twimg.com/profile_images/1313493454710857730/ddYgxm9j_400x400.jpg" Size="Size.Large" />

I am testing the app in the Android Emulator and confirmed the image properties Build Action is set to MauiImage.我正在 Android 模拟器中测试该应用程序,并确认图像属性 Build Action 已设置为 MauiImage。

Am I missing something?我错过了什么吗? Thanks in advance!提前致谢!

You can try to create a new folder named images below the project's wwwroot folder.您可以尝试在项目的 wwwroot 文件夹下创建一个名为 images 的新文件夹。 Such as:如:

在此处输入图像描述

And then you can display the image such as:然后您可以显示图像,例如:

<MudAvatar Image="images/foo.jpeg" Size="Size.Large" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM