sigmaxf
sigmaxf

Reputation: 8482

Vue callback after a click method is executed

I have a list with @click events attached to its elements. I am dynamically creating some elements (using v-if) on these clicks and I need to execute some code over these dynamically created elements If I run it on the method that @click calls, the elements are not created yet, so I can't change them. How to call a function after vue has called this method?

My code:

<li class="food" @click="loadFood(food)">

Upvotes: 0

Views: 1267

Answers (1)

Ruta
Ruta

Reputation: 36

use Vue.nextTick(function () {}) to change elements more info

Upvotes: 2

Related Questions