Answer the question
In order to leave comments, you need to log in
How to update DOM in Vue?
Hello. There is an array of data that is displayed in a loop, after the button is pressed, data is pulled from the server in the form of components, like this:
<post-item>
<!-- разметка и данные -->
<accordion>Данные</accordion>
</post-item>
Answer the question
In order to leave comments, you need to log in
Unfortunately, without reloading the page, this is not possible. Pass raw data from the server in json or as convenient, and write a v-for loop in the parent component itself,
And in data, store the items array, into which you will push new data that came from the ajax request. You need to dig a little deeper into component structure if you want to work with vue
How to update DOM?
Delete (clear) and recreate.
By default, the first elements of Component1 are loaded. Event triggered - new data needed. Replace Component1 with Component2 with the "Loading" splash screen (or the same Component1, but you need to separate the variables somehow) and immediately after the replacement, change it back to Component1 , but Component1 should receive the next batch of data, so you need to provide an AJAX request with a parameter that is stored outside Component1 (some kind of global variable).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question