【问题标题】:Ho to format an each loop in a bootstrap table如何格式化引导表中的每个循环
【发布时间】:2015-05-22 19:45:53
【问题描述】:

我想格式化引导表中的每个循环 所以这是我的 bookshelper.js 文件的代码:

  Template.books.helpers({
  'book': function(){ 
        return Books.find();
        }     
  });

在我的 books.html 文件中,我添加了一个引导表:

   <table class="table table-striped">
   <tr>
     <th>Author</th>
     <th>Title</th>
   </tr>
   {{#each book}}
     <tbody>{{author}} </tbody> 
     <tbody>{{title}}  </tbody>   
   {{/each}}   
   </table>

这是结果: http://gyazo.com/52870c76370bed527757a3c7fd5972d5 作者和标题结果都在一个列(作者)下我如何将它们划分为 2 个相应的列? My Books mongo 收藏非常简单。它只有一个 author 和一个 title 属性。非常感谢您的支持

【问题讨论】:

  • 你知道如何创建一个简单的表吗?正文 > tr > td ?

标签: twitter-bootstrap meteor


【解决方案1】:

For reference,表格是这样设计的:

<table>
  <thead>
    <tr>
      <th>Author</th>
      <th>Title</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Some Author</td>
      <td>Some Title</td>
    </tr>
    <tr>
      <td>Some Other Author</td>
      <td>Some Other Title</td>
    </tr>
    <!-- etc -->
  </tbody>
</table>

在此示例中,尝试在明显需要重复的部分周围使用您的 each 语句。在模板处理产生的 HTML 代码中应该只有一个 table、一个 thead 和一个 tbody(当然还有它们的 /table/thead/tbody)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-02
    • 1970-01-01
    • 2020-08-01
    • 2014-09-12
    • 1970-01-01
    • 1970-01-01
    • 2018-05-23
    • 1970-01-01
    相关资源
    最近更新 更多