日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

uniapp 用forEach循環遍歷數組

作者:maoge_666 更新時間: 2023-07-17 編程語言
<!-- 返回的數據:
res =[{
	"parentId": null,
	"orderNum": null,
	"categoryId": 56,
	"categoryName": "分類一",
	"sort": 6
},
{
	"parentId": 1,
	"orderNum": null,
	"categoryId": 57,
	"categoryName": "分類二",
	"sort": 6
}] -->

let parentIdList= res
parentIdList.forEach((item,index)=>{
	if(item.parentId == null){
		// 此處獲得的id為56
		this.categoryId = item.categoryId
	}
});

原文鏈接:https://blog.csdn.net/maoge_666/article/details/130151824

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新