vue 中 過濾filter 和 foreach的使用


const list  =  listArr.filter ( item => item.check)  //過濾 listArr中check屬性不為空的數據

 

循環 獲取所有數據的Id以及子節點的數據Id

let list = []

 

const rowmapId  = (item) => {

     if (item.length > 0){

         item.foreach(i => {

           list.push(i.id)

           if(i.childen.length > 0){

              rowmapId(i.childen)

             }

         })

     }

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM