当前位置:网站首页>小程序wx.request简单Promise封装
小程序wx.request简单Promise封装
2022-08-10 05:31:00 【梵鸽子】
//公共请求js
import {baseURL} from "./config.js"
export default function request(option){
return new Promise((resolve,reject)=>{
wx.request({
url: baseURL + option.url,
method: option.method || 'get',
data: option.data,
success: resolve,
fail:function(err){
reject(err)
}
})
})
}
//具体页面数据请求
import request from "./network.js"
export function getMultiData(){
return request({
url: '/home/multidata'
})
}
export function getHomeGoods(type,page){
return request({
url:'/home/data',
data:{
type,
page
}
})
}
边栏推荐
- SSM框架整合实例
- .las转.txt 再转.pcd,编译运行中出现的错误
- R绘制图像,图像特征提取
- You can‘t specify target table ‘kms_report_reportinfo‘ for update in FROM clause
- 看了几十篇轻量化目标检测论文扫盲做的摘抄笔记
- Kubernetes:(十六)Ingress的概念和原理
- How does Jenkins play with interface automation testing?
- GtkD开发之路
- Conda creates a virtual environment method and pqi uses a domestic mirror source to install a third-party library method tutorial
- el-cascader级联选择器的子菜单双击两次才显示被选中的内容
猜你喜欢
随机推荐
用Pytorch从0到1实现逻辑回归
Thread.sleep, Thread.yield role explanation
Error when installing oracle rac 11g and executing root.sh
IDEA的database使用教程(使用mysql数据库)
使用Google Protobuf 在 Matlab 中工作
使用Tenserboard可视化深度学习训练过程
el-dropdown下拉菜单样式修改,去掉小三角
共识计算和激励机制
pytorch框架学习(9)torchvision.transform
PCL点云滤波
手把手带你写嵌入式物联网的第一个项目
conda创建虚拟环境方法和pqi使用国内镜像源安装第三方库的方法教程
大咖说·对话生态|当Confluent遇见云:实时流动的数据更有价值
深度学习模型训练前的必做工作:总览模型信息
基本比例尺标准分幅编号流程
How to simulate the background API call scene, very detailed!
论文精度 —— 2017 ACM《Globally and Locally Consistent Image Completion》
Qiskit官方文档选译之量子傅里叶变换(Quantum Fourier Transform, QFT)
Pony语言学习(六):Struct, Type Alias, Type Expressions
CSDN Markdown 之我见代码块 | CSDN编辑器测评