<script> function setDate(time) { return new Promise(resolve => { setTimeout(() => { resolve(2000); }, time); }) } async function getDate() { const res = await this.setDate(1000); const data = await this.setDate(res); // 前面执行完在执行 console.log(res) console.log(data) } getDate() </script>
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
我来说两句