是否有可能创建 pugjs 组件,我可以在其中调用组件,例如 x-button Sign In
组件看起来像这样
button(class="py-3 px-8 rounded-lg inline-flex justify-center items-center font-semibold text-base leading-6 tracking-wide") #{text}
类似这个概念Laravel component
最佳答案
这就是 Pug mixins用于:
// declare the mixin
mixin x-button
button.py-3.px-8.rounded-lg.inline-flex.justify-center.items-center.font-semibold.text-base.leading-6.tracking-wide
if block
block
// use the mixin
+x-button Sign In
关于javascript - 如何创建pugjs组件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65848314/