本文摘自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 input样式修改的方法
没有babel能运行vue与react吗
bootstrap支持手机吗
什么情况下用bootstrap栅格系统
bootstrap的缓存怎么处理
bootstrap怎么关闭弹出层
bootstrap置信区间如何求
vue项目全局使用axios的方法介绍
浅谈bootstrap中glyphicons图标的用法
bootstrap轮播图不用网可以吗
更多相关阅读请进入《vue》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » vue中怎么引入bootstrap