Page jump--programmatic navigation

In fact, click on an element to trigger the event and use the method to jump. One of the most commonly used methods is recorded here.
It should be noted that: this.$router.pushin, it is router, not routes. Sometimes vscode prompts an error and it will be wrong.

<template>
  <div>
    <h3>Home页面</h3>
    <button @click="goPerson()"> 跳转到个人信息页</button>
  </div>
</template>

<script>
// @ is an alias to /src
export default {
      
      
  name: 'HomeView',
  components: {
      
      
    
  },
  methods:{
      
      
    goPerson(){
      
      
      this.$router.push({
      
      
        path: "/user/小李四/66999669"
      })
    }
  }
}
</script>

Insert image description here
Insert image description here
You can also find that the jump is not red, and this problem has not been learned yet. .

Guess you like

Origin blog.csdn.net/weixin_44239550/article/details/128665369