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