vue2.x 如何引入bootstrap

1.通过cnpm安装bootstrap和jquery

  • cnpm install bootstrap jquery --save

2.要使用bootstrap必须先引入jQuery

  • 找到build文件夹下的webpack.prod.conf.js文件打开,新增配置:
    plugins: [
        new webpack.ProvidePlugin({  
            $: "jquery",  
            jQuery: "jquery",  
            "windows.jQuery": "jquery"  
        })
    ]

3.在main.js里导入Bootstrap

import 'jquery/dist/jquery.min.js'
import 'bootstrap/dist/css/bootstrap.min.css'

猜你喜欢

转载自blog.csdn.net/CatEatApple/article/details/83061546