export async function sleep({res,time}){
    function run(){
      return new Promise((resolve,reject)=>{
        setTimeout(()=>{
          resolve(res)
        },time)
      })
    }
      return await run()
  };
/*
sleep : 模拟异步返回请求结果,当接口 不能直接调用的时候, 导入这个函数并调用
@params  
  res: object          {code:0,data:'data',msg:'ok'}
  time:  time-ms 毫秒      3000 200

@use:
     const res = yield call(sleep,{res:{
          code:0,msg:"测试成功"
        },time:3000})

*/

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2022-01-06
  • 2021-06-15
猜你喜欢
  • 2021-07-03
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2022-02-19
  • 2021-11-04
  • 2022-12-23
相关资源
相似解决方案