Vue.js cannot read item in data data

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);
                        
                    }
                });
            }
        }
Mar.01,2021

this.$parent.Notes.forEach(c => {
                    if(c['favorite']){
                        console.log(this.items);
                        
                    }
                });

you can try else if



you call the loop in type = = 2, and this is not the vue instance in the loop
so you report an error


if(type==2){
            let that = this;
            this.$parent.Notes.forEach(function(c){
                if(c['favorite']){
                    console.log(that.items);
                    
                }
            });
  }
   

is it the pointing problem of this?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b396ba-3455c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b396ba-3455c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?