vue能用bootstrap吗


本文摘自PHP中文网,作者angryTom,侵删。

如果你想了解更多关于bootstrap的知识,可以点击:bootstrap教程

一、引入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' ;

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按钮组了

boot11.png

以上就是vue能用bootstrap吗的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

vue中怎么引入bootstrap

简述为什么要使用bootstrap,有什么优点

bootstrap 如何取消自适应

bootstrap有什么ui框架?

vue和react能做什么

bootstrap是响应式的吗

vue.use中发生了什么

如何替换bootstrap中的样式

详解vue中的无渲染行为插槽

bootstrap如何设置页面回到顶端悬停提示

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




打赏

取消

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

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

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

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

评论

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