qq_35616794
qq_35616794
采纳率41.7%
2018-09-27 13:24

vue+webpack 跨域配置后不起作用

10
已采纳

//这是我的配置

dev: {
env: require('./dev.env'),
port: 8080,
autoOpenBrowser: false,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
changeOrigin: true,
target: 'http://127.0.0.1:8087',
pathRewrite: {
'^/api': '/api'
}
}
},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
// (https://github.com/webpack/css-loader#sourcemaps)
// In our experience, they generally work as expected,
// just be aware of this issue when enabling this option.
cssSourceMap: false
}
调用

axios.post('/api/login', params).then(res => res.data)

 但无法起到跨域的作用,求各位大神指点指点
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

相关推荐