update. 优化首页卡片总数是单数的时候最后一个占整行
This commit is contained in:
@@ -64,14 +64,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
{% for section in section_data %}
|
||||
{# <todo><div class="col-6 {% if forloop.last and not sections|length|divisibleby:2 %}col-md-12{% endif %}"</todo>#}
|
||||
{% if forloop.revcounter == 1 and forloop.counter|add:"0"|divisibleby:"2" == False %}
|
||||
<!-- 最后一项,且总数为奇数,则独占一行 -->
|
||||
<div class="col-12" style="margin: 15px auto">
|
||||
{% url "front:main_list" main=section.key as card_more_url %}
|
||||
{% include 'components/_news_card.html' with data=section.data unique_id=section.key more_url=card_more_url %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-md-6 col-sm-12" style="margin: 15px auto">
|
||||
{% url "front:main_list" main=section.key as card_more_url %}
|
||||
{% include 'components/_news_card.html' with data=section.data unique_id=section.key more_url=card_more_url %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user