Uncaught TypeError: Cannot read property "items" of undefined
neither this.items nor items can read it, and the strange thing is that the items in type==1 can be read into data using this.items, but not in type==2. I don"t know why I
< button type= "button" id= "allNotes" v talk to id= Click = "showNote (1)" >
<span>allNotes</span>
</button>
<button id="Favorites" v-on:click="showNote(2)">
<span>Favorites</span>
</button>
export default {
data:function(){
return{
items:this.$parent.Notes,
}
},
methods:{
showNote:function(type){
this.items="";
if(type==1){
this.items=this.$parent.Notes;
}
if(type==2){
this.$parent.Notes.forEach(function(c){
if(c["favorite"]){
console.log(this.items);
}
});
}
}