更新记录
0.0.1(2024-05-14)
下载此版本
对uni.request二次简单封装,使用了uni.addInterceptor拦截器改造为promise结构
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
- |
- |
√ |
- |
- |
- |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
使用方式
修改
const BASEURL = ''
const SUCCESSCODE = 200
const SUCCESSDATA = 'data'
挂载在全局
VUE2:
Vue.prototype.$request = Request
使用
this.$request({
extra:{
hideShowLoading:true
},
url: 'https://api.weixin.qq.com/cgi-bin/token',
data
}).then( resp => {
getApp().globalData.access_token = resp
})
//其中extra为自定义的选项,extra.hideShowLoading判断是否显示uni.showLoading