vue_cli3配置跨域

1.加公共头部
export const BASEURL='/ftserver';//跨域配置
2.

module.exports = {
      devServer: {
    port: 1188, // 端口号
    host: getIPAdress(),
    https: false, // https:{type:Boolean}
    hot:true,//配置热更新
    open: true, //配置自动启动浏览器
    proxy: {//这个是配跨域需要的
        '/ftserver': {
            target: 'http://172.16.0.141:8088/',//跨域到的目标服务器
            changeOrigin: true,//跨域代理开启
            // ws: true,//是否启用websocket
            pathRewrite: {
              '^/ftserver': '/ftserver'//我这里本来就要带/ftserver,意思是将/ftserver替换为'http://172.16.0.141:8088/'+'/ftserver'
            }
        }
    },

}
原文地址:https://www.cnblogs.com/miaSlady/p/14180017.html