异步查询回调函数调用
生活随笔
收集整理的這篇文章主要介紹了
异步查询回调函数调用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
異步查詢數據,需要對返回的數據進行后續步驟操作,使用使用方法:
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); }?
轉載于:https://www.cnblogs.com/luoxuemei/p/10931306.html
總結
以上是生活随笔為你收集整理的异步查询回调函数调用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: spring 获取url参数
- 下一篇: 一个swiper 两个分页器的写法【总结