报错如下:
Uncaught TypeError: Cannot read property 'length' of undefined
请问是哪里出问题了, 该怎么解决, 谢谢
html
changeIndex (index){
console.log(index)
this.activeIndex = index
this.sportDatabaseOrderBy = this.sportDatabase.slice(0) // 数组深拷贝
for (let i = 0; i < this.sportDatabaseOrderBy.length; i++) {
let firstLetter = py.getFullChars(this.sportDatabaseOrderBy[i].name).slice(0,1)
this.sportDatabaseOrderBy[i].firstLetter = firstLetter
}
}
在for loop时, this.sportDatabaseOrderBy是undefined.