【发布时间】:2021-05-07 03:58:59
【问题描述】:
@page "/counter"
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@if (currentCount % 2 == 0)
{
<iframe width="1660" height="1115" src="https://www.youtube.com/embed/m8e-FF8MsqU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
}
else
{
<iframe width="1660" height="1115" src="http://localhost:10726/api/Employee/HtmlReport" frameborder="0" allowfullscreen></iframe>
}
@code {
int currentCount = 0;
void IncrementCount()
{
currentCount++;
}
}
下面是返回的文本/html: enter image description here
但是,它不能显示在 blazor 页面上,但会被下载。怎么做: enter image description here
我这里使用的是代码: enter link description here
谢谢!
【问题讨论】:
-
youtube 链接可以正常工作吗?
-
不要将相关代码放在外部链接或图片中。问题出在您的 API,而不是您的客户端。
-
是的,youtube 链接工作正常
标签: c# asp.net-core blazor asp.net-core-webapi blazor-server-side