vue中怎么引入bootstrap


本文摘自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 里面添加内容

1

import $ from 'jquery' ;

相关推荐:《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按钮组了。

qqq.png

以上就是vue中怎么引入bootstrap的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

bootstrap input样式修改的方法

没有babel能运行vue与react吗

bootstrap支持手机吗

什么情况下用bootstrap栅格系统

bootstrap的缓存怎么处理

bootstrap怎么关闭弹出层

bootstrap置信区间如何求

vue项目全局使用axios的方法介绍

浅谈bootstrap中glyphicons图标的用法

bootstrap轮播图不用网可以吗

更多相关阅读请进入《vue》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...