vue引入jquery

1、安装jquery

npm i jquery -D

2、在webpack.base.conf.js里加入

var webpack = require("webpack")

3、在文件babel.config.js中的module.exports的最后加入

plugins: [
  new webpack.optimize.CommonsChunkPlugin('common.js'),
  new webpack.ProvidePlugin({
    jQuery: "jquery",
    $: "jquery"
  })
]

4、然后一定要重新

npm  run dev

5、在main.js 引入jquery

import $ from 'jquery'

posted @ 2022-11-18 17:34  hello_stone  阅读(321)  评论(0)    收藏  举报