跨域andstorage

1.跨域方法
1:cors
2jsonp
3.接口代理
通过修改nginx服务器配置来实现
新建vue.config.js
module.exports ={
devServer{
port:8080,
proxy:{
‘/api’:{
target:‘https://www.imooc.com’,
changeOrigin:true,
pathRewrite:{
‘/api’:’’
}
}
}
}}
组件中:
mounted(){
let url = “/activity/servicetime”;
jsonp(url,(err,res)=>{
let result = res;
}
}
2.storage

你可能感兴趣的:(跨域andstorage)