Answer the question
In order to leave comments, you need to log in
VUE.JS: How to use a component method inside another component?
There is an App.vue component with a set of components:
<template>
<div id="app">
<Header>
<Button onClick="" />
</Header>
<Menu />
</div>
</template>
export default {
methods: {
onMenuOpen () {// menu is opened.}
}
}
<template>
<div id="app">
<Header>
<Button :onClick="onMenuOpen" />
</Header>
<Menu />
</div>
</template>
Answer the question
In order to leave comments, you need to log in
pass the method of the Menu component as a parameter to the Button component
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question