[英]How can i access multiple object in a nested array and push them all at the same time using Vue?
let app = new Vue({
el: "#app",
data: {
currentperson: -1,
people: [{
nome: "Francesco Rossio",
immagine: "img/profile1.jpg",
oraUltimoMessaggio: "13:32",
messaggiNonLetti: "2",
visibile: true,
messaggi: [{
date: '10/01/2020 15:30:55',
text: 'Hei tu, sei molto carino, sai?',
status: 'sent'
}, {
date: '10/01/2020 15:50:00',
text: 'Sai che mi piacciono le ciabatte?',
status: 'sent'
}, {
date: '10/01/2020 16:15:22',
text: 'Ora sai tutto di me.',
status: 'received'
}],
},
this is my array and my object, I want all of the "text" object to be cycled once with a v-for
.这是我的数组和我的 object,我希望所有“文本” object 都使用
v-for
循环一次。 Is it possible?可能吗? I've been trying for hours whatever I do I can't get at the end of it.
我已经尝试了好几个小时,无论我做什么,我都无法做到。
The arrays should be rendered with the v-for
directive , nesting the v-for
for the nested array: arrays 应该使用
v-for
指令渲染,嵌套数组的v-for
:
<ul>
<li v-for="person in people" :key="person.nome">
<span>{{ person.nome }}</span>
<ul>
<li v-for="msg in person.messaggi" :key="msg.date">{{ msg.text }}</li>
</ul>
</li>
</ul>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.