Bootstrap

微信小程序——多层列表嵌套(遍历多层数组)

前言

我在写小程序的时候,出现一个问题,就是多层列表的嵌套渲染,其中包括wx:for以及wx:key的使用,借此总结下来,一是给自己总结问题,二是希望阔以帮助到大家…

一层循环

JSON代码
{
	channel: [
		{
			id: 1005000,
			name: "居家",
			url: "/pages/category/category?id=1005000",
			icon_url: "https://yanxuan.nosdn.127.net/4f00675caefd0d4177892ad18bfc2df6.png",
			sort_order: 1
		},
		{
			id: 1005001,
			name: "餐厨",
			url: "/pages/category/category?id=1005001",
			icon_url: "https://yanxuan.nosdn.127.net/4aab4598017b5749e3b63309d25e9f6b.png",
			sort_order: 2
		},
		{
			id: 1005002,
			name: "服装",
			url: "/pages/category/category?id=1005002",
			icon_url: "https://yanxuan.nosdn.127.net/93168242df456b5f7bf3c89653b3db76.png",
			sort_order: 4
		},
		{
			id: 1008000,
			name: "配件",
			url: "/pages/category/category?id=1008000"
;