代码之家  ›  专栏  ›  技术社区  ›  RudziankoÅ­

把手JS打印地图作为表格

  •  1
  • RudziankoÅ­  · 技术社区  · 7 年前

    我有JSON:

       "Fields":{  
          "AAA":0.7391,
          "BBB":0.1234,
       }
    

    我希望它呈现为:

    <table style="width:100%">
      <tr>
        <th>Fields</th>
      </tr>
      <tr>
        <td>AAA</td>
        <td>0.7391</td> 
    
      </tr>
      <tr>
        <td>BBB</td>
        <td>0.1234</td>
      </tr>
    </table>

    我怎样才能用 handlebarjs ?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Christophe    7 年前

    <table style="width:100%">
      <tr>
        <th>Fields</th>
      </tr>
    {{#each Fields}}
      <tr>
        <td>{{@key}}</td>
        <td>{{this}}</td>
      </tr>
    {{/each}}
    </table>