Vue.prototype.$await = async function(action) {
    try {
        await action();
    } catch (err) {
        // 这里是你处理错误的逻辑
        console.log("Cought Error: ", err);
    }
};
doSomething(...args) {
    this.$await(async () => {
        await asyncDealWith(...args);
    });
}

 

相关文章:

  • 2022-12-23
  • 2022-01-28
  • 2021-09-12
  • 2022-01-06
  • 2021-11-17
  • 2021-12-31
  • 2021-12-01
  • 2021-11-20
猜你喜欢
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案