[Vuejs]-Passing related model to vue 2.0 component

0👍

You can still use a method:

export default {
    data () {
        return {
            authors: []
        }
    },
    methods: {
        findAuthor (id) {
            return this.authors.find(x => x.id === id)
        }
    }
}

<ul>
  <book v-for="book in books" 
     :book="book" 
     :author="findAuthor(book.author)">
   </book>
</ul>

Leave a comment