A
A
Alexander2019-03-22 14:26:03
JavaScript
Alexander, 2019-03-22 14:26:03

Why does the updated VUE element retain state?

Explain how Vue re-renders elements.
Here's my problem - I have an element in my form template:

<div class="firstscreen__search-item">
                            <select name="city">
                                <option value="" selected disabled>Город</option>
                                <option
                                        v-for="(city, index) in cities"
                                        :value="city.ID"
                                    >{{ city.NAME_RU }}</option>
                            </select>
                        </div>

It is styled with Selectric after being created by Vue. However, when a new list of gordes arrives and the select is updated... the selectric blocks don't disappear anywhere. It's like vue doesn't completely re-render the template. But only these option updates and that's it. How do I get vue to replace the entire DOM node it's associated with when updating the data?
In particular, on the root element, I have an attribute that can be deleted in the process. I also want it to appear when vue renders the template again.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question