vue项目中引入jquery

1. 在package.json中的dependences中引入jquery的版本

 

 

 2.第二步在webpack.base.conf.js文件中加入如下内容:

const webpack = require("webpack")

 

 

'jquery': 'jquery'

 

 

 
 
plugins:[
    new webpack.ProvidePlugin({
      $:'jquery',
      jQuery: 'jquery'
    })
  ]

 

 3.第三步:安装 npm install jquery --save

4.在需要用到的地方引入jquery

import $ from 'jquery'

posted @ 2020-08-26 09:53  我自浮沉,虚浮自我  阅读(145)  评论(0编辑  收藏  举报