本文摘自PHP中文网,作者爱喝马黛茶的安东尼,侵删。

一、引入jquery
步骤:
1. 安装jquery
1 | $ npm install jquery --save-dev
|
2.在webpack.config.js 添加内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + const webpack = require("webpack");
module.exports = {
entry: './index.js',
output: {
path: path.join(__dirname, './dist'),
publicPath: '/dist/',
filename: 'index.js'
},
+ plugins: [
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery'
})
]
}
|
3.在入口文件index.js 里面添加内容
相关推荐:《bootstrap入门教程》
4.测试一下是否安装成功,看看能否弹出'123'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <template>
<div>
Hello world!
</div>
</template>
<script>
$(function () {
alert(123);
});
export default {
};
</script>
<style>
</style>
|
二、引入Bootstrap
1.安装Bootstrap
1 | $ npm install --save-dev bootstrap
|
2.在入口文件index.js里引入相关
1 2 | import './node_modules/bootstrap/dist/css/bootstrap.min.css';
import './node_modules/bootstrap/dist/js/bootstrap.min.js';
|
3.添加一段Bootstrap代码
1 2 3 4 5 | <div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-default">Left</button>
<button type="button" class="btn btn-default">Middle</button>
<button type="button" class="btn btn-default">Right</button>
</div>
|
4.运行,查看效果这些按钮已经变成Bootstrap按钮组了。

以上就是vue中怎么引入bootstrap的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
为什么前端不用bootstrap
bootstrap 怎么隐藏元素
浅谈使用bootstrap-datepicker插件实现日期录入处理功能
如何利用bootstrap分页
vue实现打印功能的两种方法(附代码)
bootstrap中fonts怎么引用
bootstrap模态窗中如何从远程加载内容?remote方法介绍
vue $on是什么意思
使用bootstrap框架有什么好处?
.vue 是什么
更多相关阅读请进入《vue》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » vue中怎么引入bootstrap