一、渲染(传递数组)

view —>.html

  1. {{each playlists}}
  2. <p>
  3. <a href="/detail?id={{$value.id}}">{{$value.name}}</a>
  4. </p>
  5. {{/each}}

http请求
index.js

router.get("/detail", async ctx=>{
    var id=ctx.query.id;
    // console.log(id)
    console.log(ctx.query.id)
    var url="https://music.aityp.com/playlist/detail?id="+id;
    var res=await axios.get(url);
    // console.log(res.data);
    await ctx.render('detail')
})