- ####vue 项目配置跨域
- ## 在 vue-project 文件下 config 下的 index 中
- module.exports = {
- dev: {
- // Paths
- assetsSubDirectory: 'static',
- assetsPublicPath: '/',
- proxyTable: {
- ## 在这里添加以下 API
- '/api':{
- target: 'http://127.0.0.1:8000/',
- changeOrigin: true, // 改变源,
- pathRewrite: {
- ???????
- '^/api': '' // 路径重写?
- }
- }
- },
来源: http://www.bubuko.com/infodetail-3342822.html