1、安装jquery
npm install jquery
2、在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'
})
]
}
});
3、在.eslintrc.js文件中添加
4、重启项目