
跨域
豪犀利
这个作者很懒,什么都没留下…
展开
-
Axios的全局配置实例和拦截器
Axios的全局配置实例和拦截器1.常用的axios全局配置axios.defaults.baseURL = ‘http://localhost:3000’ (接口地址)axios.defaults.timeout = 20002.实例配置 //常用的基本配置 const instance = axios.create({ baseURL:'http://localhost:3000', //请求的域名,基本地址 timeout:5000, //请求的超时原创 2020-09-22 18:02:39 · 1146 阅读 · 0 评论 -
vue常用的几种跨域方式
vue 跨域问题1.可以在vue脚手架中的config文件中设置代理,通过设置代理,将后台的地址http://localhost:3000配置成‘/api’dev:{ assetsSubDirectory: 'static', assetsPublicPath:'/', proxyTable: { "/api":{ target:"http://localhost:3000", //这里是后端地址 changeOrigin:true}}}2.在后台自己写跨域方法:我的是(Node原创 2020-09-22 16:02:52 · 866 阅读 · 0 评论