Answer the question
In order to leave comments, you need to log in
Interaction between components?
Hello!
Once again I want to raise the issue of the connection of components on a specific example, because. until you can figure it out on your own.
There is a completely banal example:
<template>
<header>
<div>
<app-logo />
<button> Открыть </button> // Button
<app-desktop-nav />
</div>
<app-mobile-nav /> // Component
</header>
</template>
<template>
<aside class="mob-menu" :class="{'mobile-nav--open' : visibleMobileNav}">
<div class="mob-menu__body" >
<button v-on:click="closeMobileNav">закрыть </button>
<app-mobile-menu />
</div>
</aside>
</template>
<script>
import AppMobileMenu from './AppMobileMenu'
export default {
components: { AppMobileMenu},
data() {
return {
visibleMobileNav: false
}
},
methods: {
closeMobileNav() {
this.visibleMobileNav = !this.visibleMobileNav
}
}
}
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question