qq_35616794 2018-09-27 13:24 采纳率: 41.7%
浏览 5199
已采纳

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

//这是我的配置

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条回答 默认 最新

  • devmiao 2018-09-27 15:52
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?