📜  异步函数获取 api - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:00.733000             🧑  作者: Mango

代码示例1
async function getPosts() {
  const response = await fetch('https://jsonplaceholder.typicode.com/posts?_limit=3&_page=1');
  const data = await response.json();
  return data