vue点击按钮跳转页面

按钮

<button @click="register">登录</button>

实现跳转  在methods里面写入一下代码

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

      //指定跳转的地址
      this.$router.replace('/将要跳转的路由名称')

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

      //通过push进行跳转
      this.$router.push('/将要跳转的路由名称')
    }

 

posted @ 2020-11-20 11:18  彬戈戎马  阅读(7697)  评论(0编辑  收藏  举报