当前位置:网站首页>Uni app sends request instructions using the escook / request miniprogram plug-in
Uni app sends request instructions using the escook / request miniprogram plug-in
2022-06-27 12:14:00 【Voiceless】
Request description :
According to the interface requirements , The commonly used request type is get Request and post request
get The writing method of non - parameter
//res Is the data returned by the interface , May contain 1. Request result status (success)2. data (data)3. Tips (message)
//get request uni.$http.get;post request uni.$http.post
// Request path :/home/Img/goods_video.( This interface is only an example , If you write it yourself, you need to write it according to the actual interface document )
const { data: res } = await uni.$http.get('/home/Img/goods_video')
/* for example :res The data returned is
{
"success": 1, // Successful response
"message": " To be successful ",
"data": [
{
"id": 426,
"goods_name": " Push the spiral triangle iron ",
"phone": ""
}
]
}
*/
if (res.success !== 1){
return uni.$showMsg()
}else{
//List For custom parameters ;res.data Represents the returned using the interface data Data assignment in
this.List = res.data
}
get The ginseng
//params For custom , It can also be called data, But still params Easier to understand , The parameters can be multiple , Design according to the requirements of interface documents
//search_name Is the request parameter name , This is just an example , The actual parameter name can be written according to the requirements of the interface document
// man 's suit , Request parameter value
var params = {
search_name:' man 's suit '
}
const { data: res } = await uni.$http.get('/api/public/v1/home/swiperdata',params)
if (res.success !== 1){
return uni.$showMsg()
}elses{
this.List2 = res.data
}
post Don't pass it on
const { data: res } = await uni.$http.post('/home/Infor/newselect')
if (res.success !== 1){
return uni.$showMsg()
}elses{
this.List2 = res.data
}post The ginseng
var params = {
id:123
}
const { data: res } = await uni.$http.post('/home/Infor/newselect2',params)
if (res.success !== 1){
return uni.$showMsg()
}elses{
this.List2 = res.data
}边栏推荐
猜你喜欢

解开C语言的秘密《关键字》(第六期)

Tidb 6.0: making Tso more efficient tidb Book rush

StarCraft's Bug King ia retired for 2 years to engage in AI, and lamented that it was inferior

$15.8 billion! 2021 the world's top15 most profitable hedge fund giant

【TcaplusDB知识库】TcaplusDB-tcapsvrmgr工具介绍(二)

MapReduce principle analysis (in-depth source code)

微服务拆分

私藏干货分享:关于企业架构中如何进行平台化

器审科普:创新医疗器械系列科普——胸骨板产品

MapReduce实战小案例(自定义排序、二次排序、分组、分区)
随机推荐
Deep understanding of happens before principle
Research Report on the overall scale, major manufacturers, major regions, products and application segments of hydraulic torque in the global market in 2022
Interviewer: with the for loop, why do you need foreach?
Minimum editing distance (linear DP writing method)
Master formula
器审科普:创新医疗器械系列科普——胸骨板产品
Wechat applet realizes five-star evaluation
R language uses the polR function of mass package to construct the ordered multi classification logistic regression model, and uses the vglm function of VGAM package to test the parallelism hypothesis
【面试高频题】难度 1.5/5,LCS 模板题
Summary of qstype class usage (II)
Histrix工作原理
The R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graph, specifies the grouping parameters with the b
记一次 .NET 某物管后台服务 卡死分析
今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献
This privatized deployed enterprise knowledge base makes telecommuting a zero distance
树莓派 3b+ 学习
在 Golang 中构建 CRUD 应用程序
MIT6.031 软件构造 Reading7阅读笔记Designing Specifications(设计规范)
旭日3SDB,安装原版ros
StarCraft's Bug King ia retired for 2 years to engage in AI, and lamented that it was inferior