Error in render: “TypeError: Cannot read property ‘title’ of undefined”
使用v-for的时候一定要注意:
<blog-post v-for="post in posts" v-bind:key="post.id" v-bind:title="post.title">{{post.title}}</blog-post>
posts是Vue里面的数据。
posts:[
{id:1,title:'My journey with Vue'},
{id:2,title:'My favorite language is Java'},
{id:3,title:'My lover is yao'}
]
现在是准备将posts里面数据渲染出来。
但是一直会报标题异常,在第一个代码片段中加入 v-bind:post="post"就好了