1:下载jquery
npm install jquery --save
2:打开build文件夹下的webpack.base.conf.js文件,在上方添加:
var webpack=require('webpack')
在module.exports里输入:
plugins: [
new webpack.ProvidePlugin({
$:"jquery",
jQuery:"jquery",
"windows.jQuery":"jquery"
})
],
3:在入口文件main.js中输入
import $ from 'jquery'