对象属性内部的 Var
Var inside of object attribute
我得到了这些代码
`{%for number in List %}
<div class="top">
<h3>
<a href="/my-blog-post">{{songs.history.0.Song}}</a>
</h3>
<section>
<p>{{number}}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec viverra nec nulla vitae mollis.</p>
</section>
<footer>
<small>
Posted on <time datetime="2017-04-29T19:00">Apr 29</time> in <a href="/category/code">Code</a>
</small>
</footer>
</div>
我希望 {{songs.history.0.Song}}
的数量随着循环的 var 而改变,但是当我将其更改为 {{songs.history.number.Song}}
时,元素 a
不会出现
问题是我希望号码自动更改
类似于:
{% for song in songs.history %}
<div> Number: {{loop.index}} </div>
<div> Name: {{song.Song}} </div>
{% endfor %}
我得到了这些代码
`{%for number in List %}
<div class="top">
<h3>
<a href="/my-blog-post">{{songs.history.0.Song}}</a>
</h3>
<section>
<p>{{number}}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec viverra nec nulla vitae mollis.</p>
</section>
<footer>
<small>
Posted on <time datetime="2017-04-29T19:00">Apr 29</time> in <a href="/category/code">Code</a>
</small>
</footer>
</div>
我希望 {{songs.history.0.Song}}
的数量随着循环的 var 而改变,但是当我将其更改为 {{songs.history.number.Song}}
时,元素 a
不会出现
问题是我希望号码自动更改
类似于:
{% for song in songs.history %}
<div> Number: {{loop.index}} </div>
<div> Name: {{song.Song}} </div>
{% endfor %}