關於cli3.0跨域的處理

在vue.config.js  modules export添加devservevue

devServer: {
    proxy: {
      '/baiduaa': {
        target: 'https://baidu.com', // 接口的域名
        secure: false, // 若是是https接口,須要配置這個參數
        changeOrigin: true, // 若是接口跨域,須要進行這個參數配置
        pathRewrite: {
          '^/baiduaa': ''
        }
      }
    }
  },
相關文章
相關標籤/搜索