• 对于 GET 方法,会将数据转换为 query string。例如 { name: 'name', age: 18 } 转换后的结果是 name=name&age=18
  • 对于 POST 方法且 header['content-type'] 为 application/json 的数据,会进行 JSON 序列化。
  • 对于 POST 方法且 header['content-type'] 为 application/x-www-form-urlencoded 的数据,会将数据转换为 query string。

 

                      uni.request({
					      header: {
					       	      'Content-Type': 'application/x-www-form-urlencoded'  
					       	   }, 
					      url: tha.baseURl+"project_bangding", //仅为示例,并非真实接口地址。
					       method: 'POST',
					           data: {
					               UserId: user.id
					           },
					       dataType:'json',
					       success: (res) => {
					       	 	var result = JSON.parse(res.data.projectList);
					       		
					           } 
					       }); 

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐