码迷,mamicode.com
首页 > 其他好文 > 详细

异步查询回调函数调用

时间:2019-05-27 16:30:01      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:函数   感知   his   region   cal   col   function   data   回调   

异步查询数据,需要对返回的数据进行后续步骤操作,使用使用方法:

1、new promise方法使用。

2、回调函数使用

  使用方式:  

 pageGetDeviceTreeInfo({deviceTypeAry:[1]},this.getTreeData); 

  函数:

1 export function pageGetDeviceTreeInfo(param,callback){  // 区域树接口查询,const param = {deviceType:1};//deviceType:1,人脸抓拍;2,车辆抓拍;3,WIFI感知;4,门禁感知
2   getRegionTree(param).then(rsp =>{
3     if(rsp.status==200){
4       callback(rsp.data);
5     } else {
6       callback([]);
7     }
8   });
9 };

  回调函数:

getTreeData(rstData){ // 回调函数
 console.log(rstData);
}

 

异步查询回调函数调用

标签:函数   感知   his   region   cal   col   function   data   回调   

原文地址:https://www.cnblogs.com/luoxuemei/p/10931306.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!