我如何在ionic 4应用程序中添加和使用引导程序 [英] How can i add and use bootstrap to an ionic 4 app

查看:90
本文介绍了我如何在ionic 4应用程序中添加和使用引导程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建ionic 4应用程序,我想在不使用CDN方法的情况下使用引导程序.我已经使用npm install bootstrap安装了bootstrap.

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,可以通过使用angular.json文件轻松完成

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

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

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

找到样式数组,将路径添加到下载的引导程序文件中

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

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

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

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

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

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

这篇关于我如何在ionic 4应用程序中添加和使用引导程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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