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

Hey Folks, It’s Worse Than We Thought — Claude’s Privacy Mess Just Got Bigger

  What started as a leak of shared Claude chats has turned into something much bigger — and much worse. The same thing is now happening with...