S
S
Sergey2018-08-23 23:35:22
Vue.js
Sergey, 2018-08-23 23:35:22

How to display elements of an array dynamically?

There is an array inside which there are several objects. I output the first object through the v-for directive - everything is in order. But I need to display dynamically on the 1st object, deleting the first object, displaying the second one, and so on. Please suggest how to implement this functionality.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-08-24
@beg1nner

Let's make the object to be displayed a computed property:

obj() {
  return this.items[0];
},

If it exists, output:
<div v-if="obj">
  <div v-for="(val, key) in obj">
    ...

Does it look like what you need ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question