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

AI Tools

 Midjourney oter.ai aiva googlegemin dall-e copilot jasper copilot openaiplayground