directive: v-for with parameter

by edith_tang

HTML

<div id="app">
  <table>
  <!-- 

  -->
    <thead>
      <tr>
        <th>Seq</th>
        <th>Book Name</th>
        <th>Author</th>    
      </tr>
    </thead>
    <tbody>
      <template v-for = "(book, index) in books">
        <tr>
          <td>{{ index + 1 }}</td>
          <td>{{ book.name }}</td>
          <td> {{ book.author }} </td>
      </tr>
      </template>
    </tbody>
  </table>
</div>

JavaScript

var app = new Vue({
	el: '#app',
  data: {
  	books: [
    	{ 
      	name: 'Love in the time of cholera',
      	author: 'Gabriel García Márquez'  
      },
      { 
      	name: 'Wuthering Heights',
        author: 'Emily Bronte'
      },
      { 
      	name: 'Becoming',
      	author: 'Michelle Obama'  
      }
    ]
  }
})