** For example, here when I click the button I will have one more component which means it will have new data so I want to collect all the information into one when the "Save Data" button is pressed Arrays, I hope, are easy to understand
<Child v-for="count in btnNumber" :key="count" @showData="getElements" /> <v-btn color="primary" elevation="10" class="space" large @click="duplicateEl" >Add Categ & Key</v-btn > v-btn color="secondary" elevation="13" class="btnEl" dark large @click="getResult" >Save Data</v-btn
** It uses Emit to get the data from my child component
methods:{ getElements(emitPayload) { this.selectedChildCategory = emitPayload.selectedCateg; this.selectedChildKey = emitPayload.selectedKey; this.selectedChildLanguage = emitPayload.selectedLang; this.selectedChildContent = emitPayload.selectedCon; } } duplicateEl() { this.btnNumber++; }
Try to save the data from which the event was emitted (from getting the element) to a new data variable array and use that array
You can save data on parent component, please see the following code snippet: