twitter-bootstrap 我如何向 ionic 4 应用程序添加和使用引导程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53063005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 01:23:38  来源:igfitidea点击:

How can i add and use bootstrap to an ionic 4 app

twitter-bootstrapionic4

提问by tnyamuz

Im building an ionic 4 application and i want to use bootstrap with out using the CDN method. I have installed bootstrap with npm install bootstrap.

我正在构建一个 ionic 4 应用程序,我想使用引导程序而不使用 CDN 方法。我已经使用 npm install bootstrap 安装了引导程序。

回答by Triple0t

With Ionic 4, this can be done easily by making use of the angular.json file

使用 Ionic 4,这可以通过使用 angular.json 文件轻松完成

open the angular.jsonfile, this can be located at the root of your project

打开 angular.json文件,它可以位于您项目的根目录下

locate the the styles array, add the path to the downloaded bootstrap file

找到styles数组,添加下载的bootstrap文件的路径

"styles": [
          {
            "input": "src/theme/variables.scss"
          },
          {
            "input": "src/global.scss"
          },
          {
            "input": "node_modules/bootstrap/dist/css/bootstrap.min.css"
          }
        ],

if you wish to make use of bootstrap scripts, add the bootstrap script to the scripts array as well.

如果您希望使用引导程序脚本,请将引导程序脚本也添加到脚本数组中。

Please note:for you to make use of bootstrap scripts, jquery and popper.js are required to be added to your projects as well

请注意:为了使用引导脚本,还需要将 jquery 和 popper.js 添加到您的项目中

回答by ebnibrahem

  1. create new folder public/css inside ionic app folder.
  2. inside public/css paste copy of bootstrap.min.css.
  3. add "public/css/bootstrap.min.css" string path in angular.json.
  1. 在 ionic app 文件夹中创建新文件夹 public/css。
  2. 在 public/css 中粘贴 bootstrap.min.css 的副本。
  3. 在 angular.json 中添加“public/css/bootstrap.min.css”字符串路径。

*make sure to rebuild your app .>ionic serve

*确保重建你的应用程序。>ionic serve

add-bootstrap-to-ionic4_1

将引导程序添加到 ionic4_1

add-bootstrap-to-ionic4_2

add-bootstrap-to-ionic4_2

回答by PSNR

Just paste the BootstrapCDNinto the header of src/index.html.

只需将BootstrapCDN粘贴到 src/index.html 的标题中即可。

回答by moreshwar dalvi

Go With Links.

使用链接。

1.techiediaries

1.技术日记

2.youtube

2.youtube

and rerun ionic 4 using ionic serve

并使用 ionic serve 重新运行 ionic 4