问题遇到的现象和发生背景
我在vue里运行下面的代码,为啥then后面的日志没有输出到控制台,只执行了testWay()的输出?
问题相关代码,请勿粘贴截图
const mainWay = () => {
Promise.all([
testWay()
]).then(() => {
console.log('好了');
})
}
const testWay = () => {
return new Promise(() => {
setTimeout(() => {
console.log('我要先执行')
}, 1000)
})
}
mainWay();