本地搭了http服务(localhost),怎么在vue环境下,通过axios获取到接口数据

1. 找到 vue项目\config\index.js 文件

2. 

proxyTable: {
        '/api': {
            target: 'http://127.0.0.1:9420',
            changeOrigin: true,
            pathRewrite: {
              '^/api': ''
            }
        }
    }

配置一下后,重启服务即可

posted @ 2018-02-05 17:41  Sorrow.X  阅读(3422)  评论(2编辑  收藏  举报