Bootstrap 在 Angular 6 应用程序中不起作用 [英] Bootstrap not working in Angular 6 app

查看:44
本文介绍了Bootstrap 在 Angular 6 应用程序中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Angular 6 应用程序中使用 Bootstrap,这是我迄今为止所做的,但似乎没有任何效果:

I want to make use of Bootstrap in an Angular 6 app and here is what I have done so far but nothing seems to be working out:

1) 使用 npm 安装 bootstrap、jquery 和 popper.js.2)在Angular.json文件中输入以下内容

1) Installed bootstrap, jquery and popper.js using npm. 2) Entered the following in the Angular.json file

"styles": [
    "src/styles.scss",
    "node_modules/bootstrap/scss/bootstrap.scss"
],
"scripts": [
    "node_modules/jquery/dist/jquery.slim.min.js",
    "node_modules/popper.js/dist/umd/popper.min.js",
    "node_modules/bootstrap/dist/js/bootstrap.min.js"
    ...
]

我是不是遗漏了什么.这似乎行不通.

Am I missing something. This doesn't seems to work out.

推荐答案

在你的 style.scss 文件中使用 import

@import "node_modules/bootstrap/scss/bootstrap.scss"

并从 angular.json 文件中删除 "node_modules/bootstrap/scss/bootstrap.scss"

这篇关于Bootstrap 在 Angular 6 应用程序中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆