Vue introduces JQuery error caught ReferenceError: jQuery is not defined

Error message: caught ReferenceError: jQuery is not defined

Cause Analysis:不详,本人前端处于幼儿园水平

Error screenshot:
insert image description here
Solution:
insert image description here
Add the two pieces of code in the red box to vue.config.js

const {
    
     defineConfig } = require('@vue/cli-service')
const webpack = require("webpack");
module.exports = defineConfig({
    
    
  transpileDependencies: true,
  configureWebpack: {
    
    
    plugins: [
        new webpack.ProvidePlugin({
    
    
            $: "jquery",
            jQuery: "jquery",
            "window.jQuery": "jquery",
            "window.$": "jquery",
            Popper: ["popper.js", "default"]
        })
    ]
}
})

完结撒花!!!

Guess you like

Origin blog.csdn.net/qq_46034741/article/details/130032090