Cannot read property 'length' of undefined in the component

topic description

Cannot read property "length" of undefined cannot find length in the component

related codes

/ / Please paste the code text below (do not replace the code with pictures)
1, let index = this.$utils.findObjIndex (this.name, "datum_customer_shareholder_id", p.datum_customer_shareholder_id)

          if (index > -1) {
            p.name = this.name[index].real_name
          }
          
          
          2:export const findObjIndex = (array, attr, val) => {

for (let I = 0; I

if (array[i][attr] === val) { return i }

}
return-1
}
3,
error:
clipboard.png

:

clipboard.png

what result do you expect? What is the error message actually seen?

answer

Apr.06,2022

the value of this.name is undefined, execute this.name.length, and throw this error

do a data monitoring in the function findObjIndex, or filter the data when the function is used

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