Running code in callback of Vue js $set method
<p>I have a v-for that generates a list of flights. When user clicks on "flight details" button I send an AJAX request to server, and append the new info to the results array. In order to update the view, I use $set method:</p>

<pre><code>this.results.displayed.$set(key, _.extend({}, row, detail.items));
</code></pre>

<p>Where key is $index of array object, row is the object, and detail.items is the new data (price details).
I need to change some classes after the view updates. I searched on internet and found this solution:</p>

<pre><code>this.$nextTick(function () {
    $(el.target).toggleClass('load');
});
</code></pre>

<p>Where el.target is the clicked button.
The problem is that toggleClass executes before view update and I need it to run after view updates.
Here is the complete AJAX call:</p>

<pre><code>$.ajax({
    method: 'POST',
    dataType: 'json',
    url: this.base_info.url + 'getpricedetail?token=' + this.token,
    data: {price_id : price_id},
    beforeSend: function () {
        $(el.target).addClass('load');
    }.bind(this),
    success: function (detail) {
        this.results.displayed.$set(key, _.extend({}, row, detail.items));
        this.$nextTick(function () {
            $(el.target).siblings('.prices').addClass('open');
        });
    }.bind(this),
    error: function () {
        data.vars.loading = false;
    }.bind(this)
});
</code></pre>