我的json格式如下:

"cit": {
"A": [{
    "id": "01",
	"name": "A1"
}, {
    "id": "02",
	"name": "A2"
}],
"B":[{
    "id": "03",
    "name": "B1"
},{
    "id": "04",
    "name": "B2"
}],
"C":[{
    "id": "05",
    "name": "C1"
},{
    "id": "06",
    "name": "C2"
}]
}

 html中使用,其中参数key为键名,item为对象元素,而item又是一个数组

<div v-for="(item,key) in cit" :key="key">
        <div class="title">{{key}}</div>
        <div class="item-list">
          <div v-for="itemList in item" :key="itemList.id">{{itemList.name}}</div>
        </div>
      </div>

 

Logo

前往低代码交流专区

更多推荐