js下拉框:從數組中篩選出匹配的數據


 1 handleChange(val) {
 2         let obj = {}
 3         // 遍歷數組
 4         obj = this.options.find(item => {
 5           // 篩選出匹配的數據
 6           return item.id === val
 7         })
 8         this.hzid = obj.hzid
 9         this.projectId = obj.id
10         console.log(obj, this.projectId, this.hzid)
11       },
View Code

 


免責聲明!

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



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