创建嵌套< >标记,不带换行符

Create nested <p> tag in Jade JS without trailing newline

本文关键字:换行符 嵌套 创建 标记      更新时间:2023-09-26

如何在Jade JS中完成以下操作?

<div id="container">
    Temperature<p id = "temp">00.00</p>
</div>

。,创建一个不带换行符的嵌套标记。

I have try:

// outputs newline
#container
    p#temp 00.00

// outputs literal p#temp text
#container p#temp 00.00

但它似乎不起作用。缩进也会导致解析错误。我已经看了文档,但似乎没有产生任何东西。

您可以使用:

#container
  |Temperature
  p#temp 00.00

你可以直接输入html inline:

//thermometer.jade
#container Temperature<p id="temp">#{locals.tempValue}</p>

span代替p标签

#container
    span#temp 00.00

如果一定要使用,可以使用:

#container Temperature<p id='temp>00.00</p>

空格是如何重要的?为什么重要?