首页 > 编程知识 正文

微信小程序java后端,微信小程序常用api

时间:2023-05-03 10:12:55 阅读:130009 作者:3608

gldbzio封装API接口1 )令人心动的秋季io是什么? 2 )心跳加速的秋天io能做什么? 3 )心跳加速的秋季io使用

1 )心跳加速的秋季io是什么?

一个强大的http请求库,支持基于Promise的请求传输,支持所有JavaScript运行时。 可以在多个方面尽可能地实现代码重用。

心跳加速的秋季io帮助文档

2 )心跳加速的秋天io能做什么? gldbz.js是一个基于promise的轻量级、强大的Javascript http网络库,具有以下特征:

提供统一的Promise API。 在浏览器环境下,轻量且非常轻量支持多个JavaScript运行时的请求/响应阻止程序。 自动转换JSON数据。 http://www.Sina.com/http://www.Sina.com/http://www.Sina.com/3 )心跳加速的秋季io使用NPM进行安装

npm install心跳之秋在io微信小程序中引入心跳之秋io,创建新的utils文件夹,在文件夹中输入request.js let gldbz=require (心跳之秋io/dist/npm/wx ' ) let心跳之秋=new gldbz全局请求配置//请求源地址心跳之秋. config.base URL=' https://uni app.d cloud.io/API '; 拦截器//请求添加拦截器心跳加速的秋天. interceptors.request.use () (request )//向所有请求添加自定义header,带token信息let token=//在当前页面上显示导航栏并显示动画uni.showNavigationBarLoading (; 返回请求; 添加(//响应阻止程序后,响应阻止程序会在then/catch处理之前心跳加速的秋天. interceptors.response.use () if ) response.data.errorno=0) uni.show toast (title : response.data.error info,icon: 'none ',}; } uni.hideNavigationBarLoading () return response.data; //请求成功后返回返回值},(err ) ) /在当前页面上隐藏导航栏并显示动画uni.hideNavigationBarLoading ) if(err.status===0) } let code=err.response.status; if(code===401 ) uni.navigateto ) URL:'/pages/mine/login? interceptors=1'}; }elseif(code===403 ) uni.showtoast ) (title: )没有权限,icon:(none ),); 返回promise.reject (err; } else { uni.show toast ({ title : err.response.data.message,icon: 'none ',}; 返回promise.reject (err; (导出默认值心跳加速的秋天; 添加api接口配置,在utils文件夹中创建新的api.js,GL dbz导入心跳的秋季from'./request'exportdefault(/工时记录addcheck: ) PPK 、//点赞的用户Getlikeusers:(Params )={ return心跳加速的秋天. get(/user-like-check/Getusers? id=' params; },全局装载api,并在main.js上安装importapifrom './utils/API.js ' vue.prototype.$ API=API调用接口let params={ //注释文本contentepe this.$ API.add check (params ).then ) RES={console.log ).catch(err={console.log ) //获取用户信息的界面this.$API.getuser(.then ) RES={console.log ).catch(err={console.log )

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。