[Vuejs]-How to initialize a Vue.js property with an element of array type property

0👍

It looks like you’re not processing the json stored in app.variants nor are you calling the updateAll() method. Assuming that app.variants does not need any further processing, then perhaps calling updateAll() when you receive data through the ajax request would be your best solution.

0👍

I this case I would simply use the updateAll() method you have. something like this:

  }).then(function(response) {
    app.variants = response.data;
this.updateAll(app.variants[0].image, app.variants[0].description, app.variants[0].title, app.variants[0].video)
  }).catch(function(error) {

but.. it’s not that clean 🙂

Leave a comment