javascript - How to dynamically control the router-link in vue-router not to jump when clicked
PHP中文网
PHP中文网 2017-05-19 10:26:01
0
3
833

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?

 //come code 

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

PHP中文网
PHP中文网

认证高级PHP讲师

reply all (3)
習慣沉默

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.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!