1、Promise.all() 执行结果
2、Promise.all()先后顺序执行方法实例代码
created(){
Promise.all([this.promise(),this.promise2()]).then((res)=>{
console.log(res)
console.log("最后加载的代码! ")
})
},
methods:{
promise(){
return new Promise((resolve,reject)=>{
const data={
google: "t-10001",
operating: "lists",
page: 0,
pagesize: 10,
}
this.$axios.post('vue/google.php',data).then(res => {
console.log("方法一加载完成!")
resolve(res.data.data)
})
})
},
promise2(){
return new Promise((resolve,reject)=>{
const data={
fid: "",
google: "t-10008",
operating: "lists",
page: 0,
pagesize: 10,
title: "",
type: "",
}
this.$axios.post('vue/google.php',data).then(res => {
console.log("方法二加载完成!")
resolve(res.data.data)
})
})
},
}