在config.js中写
module.exports={
devServer: {
proxy: { //配置跨域
'/api': {
target: 'http://www.weather.com.cn/', //需要解决跨域的地址
pathRewrite: {
'^/api': ''
}
},
}
},
}