RT
Problem description:
There is a link rendered by router-link in the page. Under certain circumstances, this link can jump, but under certain circumstances, it cannot jump.
Thinking:
How can we make router-link non-jumpable?
<router-link v-bind:to="url" >
//come code
</router-link>
Finally adopted hack method:
When you don’t want the user to click to jump, the url is set to the url of the current page. When you want to click to jump, the url is set to the target url
Use programmatic navigation
Then don’t you have to judge the situation? Let’s write a function using the a tag to judge
Use programmatic navigation. Specifically, use other tags such as li to bind click events (if you need to disable it, remember to add the disabled status to be complete). After business logic judgment in the event callback function, decide whether to use this.$route.push(url string Or url object entity) method to jump.