Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在不直接将变量传递给宏的情况下从宏中访问当前模板的变量?谢谢。
可以将所有上下文变量传递给宏:
{{ macro(_context) }}
_context是一个特殊变量,它包含所有当前定义的变量(按名称 => 值)。
_context