Find用来遍历查找数组元素,当找到符合条件的元素时,直接返回。

所以Find元素只会返回符合条件的第一个元素。

 

navigationList:['大学1','大学2','大学3','大学4','大学5']

let newArr=[]
newArr =this.navigationList.find(item=>item=='大学2')
console.log(newArr)

Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐