I'm currently facing an issue where I am transferring data from a child component, Form, to its parent component, App. The data transfer is functioning correctly, however, when attempting to add this data to the existing array within the App component, all previous elements within the array are being overwritten. As a result, the same element ends up appearing in each position.
<template>
<Form :addPC="getPC" />
</template>
<script>
import Form from './components/Form.vue'
export default {
name: 'App',
components:{
Form,
},
methods:{
getPC(pc)
{
var PC = {}
PC = pc
this.PCs.push(PC)
console.log(this.PCs)
}
},
data(){
return{
PCs:[]
}
},
}
</script>