点击按钮实现路由的跳转

<div @click="gotoMenu">按钮</div>

 

实现跳转

methods: {
    gotoMenu(){
      //跳转到上一次浏览的页面  this.$router.go(-1)
      this.$router.go(-1)

      //指定跳转的地址 this.$router.replace('/menu')
      this.$router.replace('/menu')

      //指定跳转的路由的名字下 this.$router.replace({name:'menu'})
      this.$router.replace({name:'menu'})

      //通过push进行跳转
      this.$router.push('/menu')
    }
  },
}

 

相关文章:

  • 2021-08-06
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-11-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2021-04-24
  • 2021-12-04
  • 2021-07-24
  • 2022-12-23
相关资源
相似解决方案