问题描述
我遇到了一个问题,因为我的应用程序加载需要花费相当长的时间,因为从我的API调用中检索了成千上万条记录,并且在加载过程中我无能为力。
是否可以异步加载这些记录,以便在加载应用程序时可以执行其他任何操作?任何帮助将不胜感激。非常感谢!
这是我的示例代码:
//this method will retrieve records from api
userPagination(url){
var requestObj = {
url: url,type: "GET",headers: {
"Content-Type": "application/json"
},contentype: "application/json",}
ZDClient.request(requestObj).then(function(assigneeUserObject){
//this will store every user info in assignee_users_fields_all
assigneeUserObject.users.forEach(function(assigneeUser){
this.assignee_users_fields_all.push(assigneeUser);
}.bind(this))
this.usersNextPage = assigneeUserObject.next_page;
if(assigneeUserObject.next_page != undefined){
this.userPagination(this.usersNextPage);
}
}.bind(this),function(err){
}.bind(this))
},//This method will call the userPagination() method
getTicketAssigneesUser(){
this.usersNextPage = "/api/v2/users.json?page=1";
this.userPagination(this.usersNextPage);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)