Home > Web Front-end > Vue.js > body text

What are the three ways to jump in Vue routing?

青灯夜游
Release: 2023-01-13 00:45:18
original
36301 people have browsed it

Jump method: 1. Use the "

What are the three ways to jump in Vue routing?

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

router-view is where routing content is implemented. When introducing components, write the place where they need to be introduced.

It should be noted that router-view must be used as a container when using vue-router to control routing.

Three ways to jump through routing

1. router-link [The simplest method to achieve jump]

Copy after login

When the browser parses it, it parses it into a tag similar to < a >.

#div和css样式略
    
  • 点击验证动画效果
  • Copy after login

    Don’t forget to introduce the path that needs to be jumped under router/index.js in advance.
    What are the three ways to jump in Vue routing?

    [Related recommendation: "vue.js Tutorial"]

    2. this.$router.push({ path: '/user'})

    is often used to pass parameters in routes. The usage is the same as the third type

    . The difference is:

    1), query introduction method

    params can only use name to introduce routes

    And query must be introduced with path

    2), query delivery method

    is similar to get parameters in our ajax, in Displaying parameters

    params in the browser address bar is similar to post. Parameters are not displayed in the browser address bar

    in the helloworld.vue file

    
     
    
    Copy after login

    in select. In the vue file,

    
     
    
    Copy after login

    3 and this.$router.replace{path: '/'} are similar and will not be repeated.

    For more programming-related knowledge, please visit : Programming Video! !

    The above is the detailed content of What are the three ways to jump in Vue routing?. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
    Latest issues
    Popular Tutorials
    More>
    Latest downloads
    More>
    web effects
    Website source code
    Website materials
    Front end template
    About us Disclaimer Sitemap
    PHP Chinese website:Public welfare online PHP training,Help PHP learners grow quickly!