P
P
Pavel2019-04-16 20:50:49
Vue.js
Pavel, 2019-04-16 20:50:49

How to fill an array in vue before html code is executed?

Good day. Help with a question. Is it possible to fill an array using a json file using axios.get, but at the same time, so that it is filled before the html code starts executing in the template part ?
This is what I need so that my slider is filled with values ​​from an already existing array. If it fills up later, then why do the slides load crookedly. So I hope for your help :pray:
the function itself

Get_active_goals: function(){
      axios
      .get('https://jsonapi.org/alt-favicons/manifest.json')
      .then(response => (this.active_goal = response.data.icons));
      console.log(this.response);
    },

The part that should only be loaded after I get the array
<template>
...
<b><div v-for="ag in active_goal" class="mycarousel_main" >
...
</div></b>
...
</template>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2019-04-16
@ppyl

directive will help youv-if="массив.length"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question