vue項目中解決跨域問題(打包上線無需手動切換url)

1、在目錄config下的index.js中設置代理; proxyTable: { //設置代理 '/api': { //使用"/api"來代替跨域地址139.xxx.xx target: 'http://139.xxx.xx', //源地址 changeOrigin: true, //改變源 pathRewrite: { //路徑重寫 '^/api': 'http://139.xxx.xx' }
相關文章
相關標籤/搜索