标签:proxy window port 版本号 plugin ack hang package bsp
1、安装jquery
npm install jquery --save
2、或则在package.json中指定版本号,然后运行npm install命令
"dependencies": {
"axios": "^0.18.0",
"core-js": "^2.6.5",
"jquery": "^3.4.1",
"vue": "^2.6.10",
"vue-awesome-swiper": "^3.1.3",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
},
3、在vue.config.js里面配置
const webpack = require(‘webpack‘);
const path = require(‘path‘);
// vue.config.js
module.exports = {
// 选项...
devServer: {
port: 8089,
// proxy:{
// ‘/‘: {
// target: ‘http://192.168.0.125:3000/‘,
// changeOrigin: true,
// pathRewrite: {}
// },
// }
},
configureWebpack: {//引入jquery
plugins: [
new webpack.ProvidePlugin({
$:"jquery",
jQuery:"jquery",
"windows.jQuery":"jquery"
})
]
},
}
然后在页面里就可以愉快的使用jquery了
标签:proxy window port 版本号 plugin ack hang package bsp
原文地址:https://www.cnblogs.com/fqh123/p/10804524.html