我谈论Angular是因为它在我的项目中,但在基本html网站中也无法使用。 我知道这个问题已经被问过多次了,但是我的下拉菜单不起作用! 我只是不想实现像这样的基本下拉菜单:
<div class="dropdown-menu">
<span class="dropdown-item-text">Dropdown item text</span>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
只需复制到引导程序文档中即可。
所以我看到此代码在Google chrome中以检查模式编写,但未显示在我的网站中。
我有1个错误:
Uncaught TypeError: Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.
at Object.jQueryDetection (bootstrap.js:240)
at bootstrap.js:255
at bootstrap.js:9
at bootstrap.js:10
因为我有这个错误,所以我检查在Bootstrap之前是否已声明jQuery。 我进入了angular.json(我也检查了路径):
"style":[
"node_modules/bootstrap/dist/css/bootstrap.css",
"src/styles.scss"],
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/bootstrap/dist/js/bootstrap.js",
"node_modules/bootstrap/dist/js/bootstrap.bundle.js"]
我使用其他一些Bootstrap模板,效果很好。 感谢您的回答。