vue项目中axios跨域解决

在config文件夹下面的index.js文件的dev中添加

proxyTable: {
      '/list': {
        target: 'http://116.111.111.111', //服务端地址
        changeOrigin: true,
        pathRewrite: {
          '^/list': ''  //list替代target
         }
      }
    },

调用axios

this.axios.post('/list/Api/auth/login')

 

posted @ 2018-01-16 20:40  ggg520danny  阅读(147)  评论(0编辑  收藏  举报