[Vuejs]-[Vue warn]: Error in render: "TypeError: Cannot read property 'type' of undefined"

0๐Ÿ‘

โœ…

I finally solved my problem.

Solution:( check the length of the array before returning value, to ensure that there is data to be returned. )

getRoomType(assign_id){
    return (this.roomTypeName.length > 0)? this.roomTypeName.find(element => element.room_id === parseInt(assign_id)).type :'error';
},

Leave a comment