欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

值得收藏的技术论坛

最编程 2024-03-25 14:33:46
...
vue-element-admin 入坑记(一)vue-element-admin 中文

weixin_42626475: 开玩笑哦,vue2.0在config.js/index.js proxyTable: {       '/api':{         target:'http://192.168.2.25:9001',//跨域地址         changeOrigin:true,//是否跨域         secure:false,//是否使用https         pathRewrith:{             '^api':'/api'//这里要理解成用'/api'代替target里面的地址,后面的组件中我们调用接口的时候直接用api代替,比如我要调用'http://40.00.100:3002/user/add',直接写成'/api/user/add'即可                         }              }       }, vue3.0的代理是vue.config.js里面 proxy: { '/api': { // target: 'http://172.16.15.27:8081', target: 'http://172.16.15.159:8080/', secure: false, // false为http访问,true为https访问 changeOrigin: true, // 跨域访问设置,true代表跨域 ws: true, pathRewrite: { // 路径改写规则 '^/api': '' // 以/proxy/为开头的改写为'' } } }

推荐阅读