zoukankan      html  css  js  c++  java
  • 回调函数的使用

    回调函数的引用场景:我们有些时候,会需要某一个请求中的数据。
    得到数据后,我们需要将这个数据作为参数去请求另外一个接口。
    我们不知道什么时候,第一个请求中数据才返回来。
    所以这个时候我们就需要回调函数来处理这个问题
    
        created(){
                this.postRendingNoteApi((data)=>{
                    // 拿到回调内容,去调用解密请求
                    this.imgjiemi(data);
                })
         },
    
         methods:{
                postRendingNoteApi(callccalback){
                    let logParams={
                        pageIndex:1,
                        pageSize:20 
                    };
                    this.$api.postRendingNote(logParams).then(res=>{
                        callccalback(res.data);//返回回调需要的内容
                    })
                },
    
                        
                imgjiemi(arrlen){
                      //do something   
                },     
           }
    
  • 相关阅读:
    hadoop使用FAQ
    kerberos在rehl6和7不兼容问题
    zookeeper使用场景
    临时记录
    SecureCRT远程工具
    jdk 环境安装
    等效
    lnmp安装及nagios
    svn的安装使用
    用户在乎的事
  • 原文地址:https://www.cnblogs.com/IwishIcould/p/13258199.html
Copyright © 2011-2022 走看看