小程序过滤数据最简便的方法 filter
作者:互联网
使用filter进行过滤
例:
通过id匹配要用的数据
hoperightList().then(res=>{ this.setData({ rightList:res, quactionList:res.filter(e=> e.categoryId===36196), shopingList:res.filter(e=> e.categoryId===36197), dingdanList:res.filter(e=> e.categoryId===36198), xieyiList:res.filter(e=> e.categoryId===36203), }) })
总结:
filter(e=>e.需要匹配的条件)*
标签:匹配,res,categoryId,filter,过滤,quactionList,简便 来源: https://blog.csdn.net/Hdd_whj/article/details/115709246