SOURCE

console 命令行工具 X clear

                    
>
console
// new Vue({
//     el: '#app',
//     async created() {
//         await this.func();
//         // this.func().then(() => {
//         //     console.log('1')
//         // })
//         // this.func2();
//         console.log('created')
//     },
//     mounted() {
//         console.log('mounted')
//     },
//     methods: {
//         func() {
//             return new Promise((resolve, reject) => {
//                 setTimeout(() => {
//                     console.log('func')
//                     resolve();
//                 }, 1000)
//             })
//         },
//         async func2() {
//             await this.func()
//         }
//     }
// })

function asyncFunc() {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log('asyncFunc')
            resolve();
        }, 1000)
    })
}

async function foo() {
    console.log('start')
    await asyncFunc();
    console.log('end')
}

foo();
<div id="app"></div>

本项目引用的自定义外部资源