1. 程式人生 > >vue2.x 如何引入bootstrap

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'