Reputation: 1635
In Vue component, when set the 'PROPS' immediately, needs to update the collection to include additional property.
Component is:
Vue.component('blog-post', {
props: ['dataArray'] //needs to update this value when it sets.
...
})
Upvotes: 0
Views: 1308
Reputation: 1
You could change it in the parent by emmiting the value from the child component like :
Vue.component('blog-post', {
props: ['dataArray'] //needs to update this value when it sets.
,
methods:{
update(val){
this.$emit('updatedata',val)
}
}
})
and in the parent component use it as follow :
<blog-post @updatedata="updatedataArray"><blog-post>
...
methods:{
updatedataArray(val){
//update your data array
}
}
Upvotes: 1