使用以下命令安装 jquery

npm install jquery --save

在vue.config.js中配置

const webpack = require('webpack')
module.exports = {
  chainWebpack: config => {
    config.plugin('provide').use(webpack.ProvidePlugin, [{
      $: 'jquery',
      jquery: 'jquery',
      jQuery: 'jquery',
      'window.jQuery': 'jquery'
    }])
  }
}

在需要使用的页面中引入即可使用

import $ from "jquery"


❀❀❀❀❀❀完结散花❀❀❀❀❀❀

Written ❤️ sywdebug.

更多推荐

在vue中使用jquery方法