Answer the question
In order to leave comments, you need to log in
How to make 2 arrays in Vue?
Hello. There is such a simple construction in Vue
<ul id="example-1">
<li v-for="item in items">
{{ item.message }}
</li>
</ul>
var example1 = new Vue({
el: '#example-1',
data: {
items: [
{ message: 'Foo' },
{ message: 'Bar' }
]
}
})
Answer the question
In order to leave comments, you need to log in
You just need to create a second list and a separate ul for it
<div id="example-1">
<ul>
<li v-for="item in items1">
{{ item.message }}
</li>
</ul>
<ul>
<li v-for="item in items2">
{{ item.message }}
</li>
</ul>
</div>
var example1 = new Vue({
el: '#example-1',
data: {
items1: [
{ message: 'Foo' },
{ message: 'Bar' }
],
items2: [
{ message: 'Foo' },
{ message: 'Bar' }
]
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question