Answer the question
In order to leave comments, you need to log in
How to close modal when clicking in router-link?
Hello. I don't know much about vue yet.
There is a link in the modal. <router-link to="/privacy" >ТЕКСТ</router-link>
The modal should be closed by clicking on this link - like this.
@click="$store.commit('hideModal')"
,
but you also need to follow the link.
When I do it like this
<router-link to="/privacy" @click="$store.commit('hideModal')">ТЕКСТ</router-link>
Answer the question
In order to leave comments, you need to log in
You can not use a router-link, but call via $router.push('/privacy') in the click handler after opening the modal
To cancel the transition, there is @click.prevent
If you want to open a modal, then why use routing? make the same button, put the method of opening the modal there and that's it - it works
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question