如何使用 slim 将一个 div 嵌套在 for 循环中的另一个 div 中
我有以下代码,
div class = "content"
- for x in list
-if x == "test"
div id = "two"
我希望 div id = "two
嵌套在 div class="content
中,但它显示为自己单独的 div。我将如何根据条件将 div 嵌套在内容 div 中?
I have the following code
div class = "content"
- for x in list
-if x == "test"
div id = "two"
I would expect div id = "two
to be nested within div class="content
however it appears as its own separate div. How would I go about nesting the div within the content div based on the conditional?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要缩进第 2-4 行,否则它们将被视为兄弟姐妹。引用文档...
You need to indent lines 2-4, otherwise they're treated as siblings. To quote the docs...