if if pug语句
我试图弄清楚如何进行内联如果
语句:
div(class="social-text").
#[b #{share.title}] #{share.bodyText}
在上面的代码中,share.title = undefined
。如果是,我不想呈现< b></b>
在结果html
中标记,但无法弄清楚该如何工作在哈巴狗中。
I'm trying to figure out how to do an inline if
statement:
div(class="social-text").
#[b #{share.title}] #{share.bodyText}
In the code above it's possible that share.title=undefined
. In case it is, I don't want to render a <b></b>
tag in the resulting html
but can't figure out how that works in pug.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不使用 block标签语法初始
div
之后。您可以这样写,使用标准条件和 piped text :This is simpler to write if you don't use the block in a tag syntax after the initial
div
. You could write it like this instead, using a standard conditional and piped text: