7***@qq.com
7***@qq.com
  • 发布:2022-07-18 10:33
  • 更新:2022-07-18 10:33
  • 阅读:377

uni post 请求

分类:uni-app
uni.request({  
                url: 'url',  
                method:'POST',  
                data:{  
                    data:data  
                },  
               //post提交的时候加上这个header  
                header: {  
                    'Content-Type':'application/x-www-form-urlencoded'      //注意请求头  
                },  
                success: (res) => {  
                    console.log(res.data);  
                }  
            });  

请求头写错,会出现cors问题

0 关注 分享

要回复文章请先登录注册