数据处理-判断数组对象中是否含有某个值,并返回该条数据

42 阅读1分钟

判断数组对象中是否含有某个值,并返回该条数据

   let visiblelist=ref<any>({})
          if(JSON.stringify(list).indexOf(componentId)!=-1){
            list.map((value,index)=>{
              if(componentId===value.key){
                visiblelist =value
              }
    })}