我想在宏中使用宏。但这是如何工作的?
{% import _self as formSubmacros %}
{% macro printSubcategoriesRow(SubcategoriesForm) %}
<div class="the content of the subcatecories">
</div>
{% endmacro %}
{% import _self as formMacros %}
{% macro printCategoriesRow(CategoriesForm) %}
<div class="the content of the categories with the macro subcategories">
{% for SubcategoriesForm in CategoriesForm.subcategories %}
{{ formSubmacros.printSubcategoriesRow(SubcategoriesForm) }}
{% endfor %}
</div>
{% endmacro %}
但这不起作用......
你应该把import
放到你的宏中,以获得适当的范围。如果这不起作用,请提供错误消息