I am passing data from a child component (Form) to its parent component (App).The data is being passed just fine but when I need to add the data to the array created in the App component,all previous elements in the array are overwritten and the same element appears 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>