Answer the question
In order to leave comments, you need to log in
How to switch the main component to the specified one, inside the method of another one?
Good afternoon. The question is probably written a little incorrectly, but I could not find anything on my problem in Google, so I decided to write here.
I have App.vue
<template>
<div id="app" class="go_section">
<start-screen></start-screen>
</div>
</template>
Answer the question
In order to leave comments, you need to log in
You have a template d.b. something like:
<template>
<div>
...
<template v-for="point in points" :key="point.id">
<point :point="point" @click="$emit('gotoOtherComponent')"></point>
</template>
</div>
</template>
<template>
<div id="app" class="go_section">
<start-screen @gotoOtherComponent="showOther=true" v-if="!showOther"></start-screen>
<other-screen v-if="showOther"></other-screen>
</div>
</template>
In the child component emit('something', param), in the connection of the child component in the template in the methods {myfunction: function(param) {...}} the parent has the necessary actions
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question