1、加依赖
cnpm install jquery
cnpm install bootstrap
2、main.js
import jquery from 'jquery'
import bootstrap from 'bootstrap'
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min.js'
Vue.use(jquery);
Vue.use(bootstrap);
3、build/webpack.base.conf.js
//文件头添加
var webpack = require('webpack');
//resolve 模块添加 juqery
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'jquery': 'jquery'
}
},
// 增加一个plugins
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
],
网友评论