【发布时间】:2019-10-24 01:50:35
【问题描述】:
Blazor 中的新手。需要尝试如何在 Blazor 中使用 BS carousel。
我在默认 Blazor 应用程序中使用了以下代码。但它不起作用。我需要做什么?
谢谢
-
我在 Index.html 中添加了这一行
在计数器页面中。我添加了以下内容:
<div class="carousel-inner">
<div class="item active">
<img src="la.jpg" alt="Los Angeles" style="width:100%;">
<div class="carousel-caption">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="item">
<img src="chicago.jpg" alt="Chicago" style="width:100%;">
<div class="carousel-caption">
<h3>Chicago</h3>
<p>Thank you, Chicago!</p>
</div>
</div>
<div class="item">
<img src="ny.jpg" alt="New York" style="width:100%;">
<div class="carousel-caption">
<h3>New York</h3>
<p>We love the Big Apple!</p>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
-- 更新:Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>BlazorCarouselTest</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
<script src="css/bootstrap/jquery-3.4.0.min.js" type="text/javascript"></script>
</head>
<body>
<app>Loading...</app>
<script src="_framework/blazor.webassembly.js"></script>
</body>
</html >
【问题讨论】:
-
无错误消息。它垂直显示了所有 3 张图像。它假设逐个显示水平滚动图像。我已经下载了 jquery-3.4.0.js 并将其放在与 bootstrap 相同的文件夹中。
-
您的 Blazor 项目是否包含轮播所需的所有 JS?请参阅引导快速入门页面 - 特别是 JS 部分。也许向我们展示您的 index.html 的 head 部分?
-
请看更新