当前位置:网站首页>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
}
边栏推荐
- Time management understood after being urged to work at home
- 想学好C语言,操作符也很重要
- 动态规划【四】(计数类dp)例题:整数划分
- 动态规划【三】(区间dp)石子合并
- i.mx6ull(单片机) c语言环境搭建
- The DBSCAN function of FPC package in R language performs density clustering analysis on data, and the plot function visualizes the clustering graph
- uni-app 使用escook/request-miniprogram插件发请求说明
- Maximum path and problem (cherry picking problem)
- 巅峰小店APP仿站开发玩法模式讲解源码分享
- [tcapulusdb knowledge base] Introduction to tcapulusdb system management
猜你喜欢
Nifi from introduction to practice (nanny level tutorial) - identity authentication
pull request
Wechat applet realizes five-star evaluation
进程间通信详解
解开C语言的秘密《关键字》(第六期)
Minimum editing distance (linear DP writing method)
AUTOCAD——三种修剪方式
JSP自定义标签
In 2021, the global carbon graphite brush revenue is about US $2366million, and it is expected to reach US $2701.8 million in 2028
今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献
随机推荐
JSP自定义标签
想学好C语言,操作符也很重要
Research Report on the overall scale, major producers, major regions, products and application segments of swine vaccine in the global market in 2022
Jianmu continuous integration platform v2.5.0 release
I.MX6ULL启动方式
解开C语言的秘密《关键字》(第六期)
2022ciscn central China Web
How to participate in openharmony code contribution
Go Web 编程入门:验证器
i.mx6ull(单片机) c语言环境搭建
R语言使用MASS包的polr函数构建有序多分类logistic回归模型、使用VGAM包的vglm函数对有序多分类logistic回归模型进行平行性假设作检验
AI for Science:科研范式、开源平台和产业形态
Time management understood after being urged to work at home
旭日3SDB,安装原版ros
[tcapulusdb knowledge base] tcapulusdb OMS business personnel permission introduction
内存四区(栈,堆,全局,代码区)
threejs的环境光+点光源+平行光源+球面光 以及hepler理解+阴影()
怎么找相同台词的影视片段?这8个电影搜索神器,一句台词找到对应片段
Drive to APasS!使用明道云管理F1赛事
Popular science of device review: popular science of innovative medical device series - sternum plate products