js,vue 异步 async和await使用 电脑版发表于:2022/8/14 22:32 注意点就是使用await关键字要注意使用async关键字配合,不然会报错的。看下图的用法与注释 ![](https://img.tnblog.net/arcimg/xiuxin/6d0bcc336c634f679f54d3e644117def.png) **在vue2中的使用** ``` methods: { getSchoolListByTeacher: async function () { console.log("开始获取校区信息") let result = await this.$http.get('/education/api/Activity/GetCurrentUserSchool') console.log(result) this.schoolList = result.data } } ```