How to tell whether an element is in an array in vue?

how to determine whether the id of tzlist exists in read_id? If the id:3 of tzlist exists in read_id, delete class= "net".

how to achieve this?

the newlyweds can"t thank the newlyweds for asking for help.

Nov.08,2021

is simple. Change the class of 11 lines of span to this: : class= "{net: read_id.indexOf (item.id) =-1}"


pass the value value to isInArray and return ture by traversing tzlist. If false is returned, it does not exist.

function isInArray (arr,value) {

    for(var i = 0; i < arr.length; iPP){
        if(value === arr[i]){
            return true;
        }
    }
    return false;
}


this.read_id.forEach((v)=>{
    let aa = this.tzlist.find(c=>c.id==v);
    if(aa){
        // class xxx.
    }
})

</span>
</div>
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-1e9de81-466d7.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-1e9de81-466d7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?