介绍下html的一些语法
1.for循环
<body>
{% for song in songs %}
<hr>
<h1>{
{ song.name }}</h1>
{% endfor %}
</body>
2.字典中索引取值
<h3>{
{ songs.0.name}}</h3>
3.占位(只能在for循环中使用,当循环中没有信息渲染时,会渲染empty下的内容)
<body>
{% for song in songs %}
<hr>
<h1>{
{ song.name }}</h1>
{% empty %}
<h3>臥槽沒東西</h3>
{% endfor %}
</body>
4.当前循环值
<body>
{% for song in songs %}
<hr>
<h1>当时循环是{
{ forloop.counter }}:{
{ song.name }}</h1>
{% comment %}直接录入参数forloop会返回Json字符串,还可以获取其他的值,比如是否第一个{% endcomme