引入
$ npm install jquery bootstrap --save
jQuery
1、加入webpack对象:
var webpack=require('webpack');
2、在module.exports里面加入
plugins: [
new webpack.ProvidePlugin({
$:"jquery",
jQuery:"jquery",
"windows.jQuery":"jquery"
})
]
3、在入口文件main.js中加入
import $ from 'jquery'
全局引入jq
bootstrap
1、修改webpack.base.conf.js文件:
alias: {
'vue$': 'vue/dist/vue.esm.js',
'jquery': "jquery/src/jquery"
},
2、在入口文件main.js中加入:
import '../node_modules/bootstrap/dist/css/bootstrap.min.css'
import '../node_modules/bootstrap/dist/js/bootstrap.min'