2017-05-28 125 views
0

如何正确地为以下HTML表格结构实施v-for标签?我有兴趣重复在文件中的foreach文件。添加V-了以“TR HTML标签:不给我预期的结果Vuejs v-for与分割单元格的表格

<table border="1" align="right" width="200"> 
     <thead style="background-color: #87cefa;"> 
     <tr class="uppercase"> 
      <th> File Name</th> 
      <th> Action</th> 
     </tr> 
     </thead> 
     <tr> 
      <td rowspan="2">File#1</td> 
      <td>top right</td> 
     </tr> 
     <tr><td>bottom right</td> 
     </tr> 
    </table> 

回答

2

,您可以尝试这样

<table border="1" align="right" width="200"> 
    <thead style="background-color: #87cefa;"> 
     <tr class="uppercase"> 
      <th> File Name</th> 
      <th> Action</th> 
     </tr> 
     </thead> 
     <tbody v-for="(file,index) in 5"> 
     <tr > 
      <td rowspan="2">File#{{index}}</td> 
      <td>top right</td> 
     </tr> 
     <tr><td>bottom right</td> 
     </tr> 
    </tbody> 
</table> 

下面是jsFiddle