Bootstrap 4 使用“npm i引导”安装时如何在HTML中包含引导JS文件
我想用bootstarp制作可折叠的导航栏。我使用npm下载了引导程序Bootstrap 4 使用“npm i引导”安装时如何在HTML中包含引导JS文件,bootstrap-4,Bootstrap 4,我想用bootstarp制作可折叠的导航栏。我使用npm下载了引导程序 如何包含引导JS文件以使navbar可折叠?有3种可能的解决方案: 如果您在脚本标记中添加了引导js,并且节点模块路径大于导入 通过脚本标记中的此行执行特定功能 窗口“引导\节点\模块\名称” 添加cdn链接或下载不带npm的引导脚本。 NPM在node_modules目录中安装包。您必须从那里导入引导 <link rel="stylesheet" href="../node_modules/bootstrap/d
如何包含引导JS文件以使navbar可折叠?有3种可能的解决方案: 如果您在脚本标记中添加了引导js,并且节点模块路径大于导入 通过脚本标记中的此行执行特定功能 窗口“引导\节点\模块\名称” 添加cdn链接或下载不带npm的引导脚本。 NPM在node_modules目录中安装包。您必须从那里导入引导
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css">
<script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
在angular.json中,将文件路径添加到Underbuild目标中的样式和脚本数组中,如下所示:
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ng6",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css","node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": ["node_modules/jquery/dist/jquery.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js"]
},
我建议采用第三种解决方案。因此,在部署代码时,您将不会有依赖项。我尝试导入如下内容:仍然可折叠的navbar不工作。我只是想尝试使用npm I bootstrapwhat error is show??您已经包含了这个引导文件。什么样的产出即将到来。