您可以将 Bootstrap 添加到 Ionic 应用程序吗? [英] Can you add Bootstrap to a Ionic App?
本文介绍了您可以将 Bootstrap 添加到 Ionic 应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在开发一个 Ionic 应用程序,我想知道是否可以添加一个基于 Bootstrap 的图片库.我知道 Ionic 和 Bootstrap 不能很好地协同工作,但我想知道是否有可能.
I am currently developing an Ionic app and I was wondering if I could add an image gallery based on Bootstrap. I know Ionic and Bootstrap don't work really well together, but I was wondering if it is possible.
推荐答案
第一步:
安装引导程序:
Step 1:
Install bootstrap:
npm 安装引导程序
第 2 步:
编辑 package.json:
Edit package.json:
"description": "An Ionic project",
......
"config": {
"ionic_sass": "./sass.config.js"
}
第 3 步:
在主文件夹中创建新文件 sass.config.js
Create new file sass.config.js in home folder
module.exports = {
includePaths: [
"node_modules/ionic-angular/themes",
"node_modules/ionicons/scss",
"node_modules/ionic-angular/fonts",
"node_modules/bootstrap/scss"
]
};
第 4 步:
编辑 variables.scss
Edit variables.scss
@import "noto-sans";
......
@import "bootstrap";
第 5 步:
添加引导代码:
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
第 6 步:
运行离子应用
离子服务
这篇关于您可以将 Bootstrap 添加到 Ionic 应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文