Javascript V-for vue.js数据
嗨,我正在努力展示我所有的阵列 在这个示例中,我只能显示第一行,因为[0] 我想展示给大家看Javascript V-for vue.js数据,javascript,vue.js,Javascript,Vue.js,嗨,我正在努力展示我所有的阵列 在这个示例中,我只能显示第一行,因为[0] 我想展示给大家看 <div class="description" v-for="item in sitePartVoice[0].part_attributes"> <small><strong>{{item.x_name}}</strong> {{item.x_value}}</small> </div> {{item.x_name}{{{i
<div class="description" v-for="item in sitePartVoice[0].part_attributes">
<small><strong>{{item.x_name}}</strong> {{item.x_value}}</small>
</div>
{{item.x_name}{{{item.x_value}
我试过这个
<div v-for="item in items">
<div class="description" v-for="item in sitePartVoice.part_attributes">
<small><strong>{{item.x_name}}</strong> {{item.x_value}}</small>
</div>
</div>
{{item.x_name}{{{item.x_value}
没有成功
谢谢假设您拥有此类数据:
数据:()=>({
sitePartVoice:[
{
第四部分属性:[
{
建议1:‘价值1’
}
]
},
{
第四部分属性:[
{
建议1:‘价值1’
}
]
}
]
})
然后循环每个sitePartVoice
并循环其中的part\u属性
:
<div v-for="item in sitePartVoice">
<div class="description" v-for="i in item.part_attributes">
<small>{{i.prop1}}</small>
</div>
</div>
{{i.prop1}}
它应该是
<div v-for="siteParts in sitePartVoice">
<div class="description" v-for="item in siteParts.part_attributes">
<small><strong>{{item.x_name}}</strong> {{item.x_value}}</small>
</div>
</div>
{{item.x_name}{{{item.x_value}
能否显示数据的外观?在我看来,sitePartVoice
是一个数组,所以你不能直接获得part\u属性。我猜它会像外部div上的v-for=“sitePartVoice中的part”
,然后是内部div上的v-for=“item in part.part\u attributes”
,你的数据数组是什么样子的?