Twitter引导两列渲染玉?

时间:2012-03-10 12:27:51

标签: twitter-bootstrap pug

我知道如何使块看起来在引导程序中,但我不知道如何在玉中制作它。 结构应如下所示

// Input
for post in posts

// Output should be this
div.row
  /// Looped from each
  div.span6

    ..More content POST 1
  div.span6  
    ..More content POST 2
div.row
  /// Looped from each
  div.span6
    ..More content POST 3
  div.span6  
    ..More content POST 4
div.row
  /// Looped from each
  div.span6
    ..More content
  div.span6  

//编辑这是我的解决方案,使用mixin

mixin blogPost(post)
  div.span6
    ...code

div
  - for (var i = 0; i < postList.length; i++)
    div.row
      mixin blogPost(postList[i])
      - if (i + 1 < postList.length)
        mixin blogPost(postList[i + 1])

1 个答案:

答案 0 :(得分:2)

我在这里发布解决方案

mixin blogPost(post)
  div.span6
    ...code

div
  - for (var i = 0; i < postList.length; i++)
    div.row
      mixin blogPost(postList[i])
      - if (i + 1 < postList.length)
        mixin blogPost(postList[i + 1])