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.
我安装了pypugjs,将它添加到settings.py,它工作正常,但是当我试图将对象传递给 Pug mixin 时 - 我得到了TemplateSyntaxError-
pypugjs
settings.py
TemplateSyntaxError
Could not parse the remainder: '{age:20' from '{age:20'
mixin card(data) div #{data} +card({age:20, name:'Alex'})
如何在Django中将多个命名文件传递给Pug mixin?
你会这样做:
mixin card(age, name) div {{ age }}, {{ name }} +card(20, 'Alex')
或者(我简化以测试我的答案:)
mixin card(data) div {{ data.age }}, {{ data.name }} +card(data)