can we call parent method from child component in vuejs

 we have two components

one is child componet and another one is pareant component


fetch is parent component 


another moderation .vue - its child

we import alert componet so its child

<submit-component
ref="submitComponent"
:max_submit_queue_count="max_submit_queue_count"
:direct_submit="direct_submit"
:multi_level_submit="multi_level_submit"
@onSubmit="afterSubmit()"
@onAlert="onAlert($event)"
@onSubmittedCount = SubmittedCount($event)
></submit-component>


v-on -> onsubmit event

afterSubmit(){
this.$refs.fetchComponent.autoFetch();
this.$refs.editorComponent.reload();
this.$refs.editorComponent.showThumbnailsTab();
},


fetchcomponent.vuie

autoFetch(){
if(!this.fetching && this.auto_fetch && this.my_queue_count < this.max_auto_fetch){
this.fetchAssignments(this.getRouteParams('level'));
this.createAssignmment(1);
}
},


No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...