await 让代码按字面顺序执行!
this.heroes = await data.getHeroes();
data.getHeroes() 会 return 一个 Promise 对象,如果直接写 this.heroes = data.getHeroes(),就会直接把Promise对象赋值给this.heroes, 而我们需要的是 Promise 的 result,所以必须加上 await 关键字。
await 必须用在 async 函数中,如果函数没有加上 async ,程序会报错,所以 await 和 async 必须成对出现。
async 函数返回一个 Promise 对象。