分配帕格混合蛋白到可变
有什么办法将哈巴狗混合蛋白分配给变量? (nb 不是混合蛋白的结果。)
即类似的东西:
mixin a
...
mixin b
...
mixin c
...
-
let myMixin;
switch (someCondition) {
case 1: myMixin = b; break;
case 2: myMixin = c; break;
default: myMixin = a;
}
...And then use it like this further down in the template:
+myMixin
Is there any way assigning a Pug mixin to a variable? (N.b. not the results of the mixin.)
I.e. something like this:
mixin a
...
mixin b
...
mixin c
...
-
let myMixin;
switch (someCondition) {
case 1: myMixin = b; break;
case 2: myMixin = c; break;
default: myMixin = a;
}
...And then use it like this further down in the template:
+myMixin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在哈巴狗中使用动态混合素:
创建一种生成动态混合物的混合蛋白,例如:
然后使用Dynamic Mixin Easy:
注意: Dynamic Mixin的名称必须是字符串。
You can use dynamic mixins in Pug:
Create a mixin which generate a dynamic mixin, e.g.:
Then use dynamic mixin easy:
Note: The name of dynamic mixin must be a string.