vue项目启动时发生错误,在配置文件vue.config.js中处理跨域代理的proxy配置对象是空值。
//配置跨域请求
devServer: {
// port: 8080,
// host: '0.0.0.0',
// open: true,
// https: false,
// proxy: {
// // '/api': {
// // target: 'http://api0.map.bdimg.com/',
// // changeOrigin: true,
// // pathRewrite: {
// // '^/api': ''
// // }
// // },
// }
}
处理方法:
将devServer对象中 的内容注释掉即可