I am working with vue and currently have not been able to fix this problem, the problem is as follows:
written explanation
I have a normal html template and I want a vue component to be added to that template when pressing a button, but not just one, but how many times they hit that button, giving it a limit (optional)
Explanation in code
// Main
Vue.component('component-a', { /* ... */ })
new Vue({ el: '#app' })
// HTML
<div id="app">
<component-a></component-a>
<component-a></component-a>
<button @select="addComponent">Agregar Componente</button>
</div>
When pressing the button I want another component to be added to the dom, how would I do that?
It is important to always read the documentation of the framework you are using.
In this case, in this section , is exactly what you want to do.
We simply iterate over a variable in this case, but note that you have examples to iterate over lists or whatever you think is necessary.