在配置文件中加入本行即可
cors.allowOrigin.enable=true
在vue中配置跨域,打开前端项目中的config文件夹下的index.js文件,其中在dev下有个空的proxyTable,在其中添上
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': { //使用"/api"来代替"http://f.apiplus.c"
target: 'http://127.0.0.1:9999', //源地址
changeOrigin: true, //改变源
pathRewrite: {
'^/api': '/' //路径重写
}
}
},