两种同步等待方式

setTimeout

wait(callback,seconds){
    let timelag=null;//这里应该用if判断一下;可以扩展
    timelag=window.setTimeout(callback,seconds);
  }

this.wait(()=>{
      //等待后的调用函数
},10);

async await

Sleep = (ms:number)=> {
  return new Promise(resolve=>setTimeout(resolve, ms))
}

  async routeToLogpage(){
    await this.Sleep(900);
    ipcRenderer.send('tomax');
    await this.Sleep(200);
    this.router.navigate(["/logpage"]);
  }