vue点击实现 路由的跳转


点击按钮实现路由的跳转

<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')
    }
  },
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM