这篇文章给大家介绍的内容是关于promise对象promise.all()方法在vue中如何使用?有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
1、定义promise
2、在组件中使用
methods: {
loginInFun () {
localStorage.setItem('userId', '00001')
let params = {
telphone: this.username,
password: this.password
}
let pro1 = this.promiseFun('itArtison/user/login', params)
let pro2 = this.promiseFun('itArtisOn/user/register', params1)
// 使用 Promise.all()
Promise.all([pro1, pro2]).then(
(res) => {
console.log(res);
}
).catch(
(err) => {
console.log(err)
}
)相关文章推荐:
立即学习“前端免费学习笔记(深入)”;










