router 跳转页面

 vue页面跳转:

1、标签跳转:

 <router-link to='two.html'><button>点我到第二个页面</button></router-link>

 

 2、html点击事件跳转:

  html :
 <button @click="hreftwo" class="test-one">点我到第二个页面</button>
   
  js :
      methods:{ //跳转页面
         hreftwo(){
              this.$router.push({ 
path:'/two.html'
}) } }

 

实际Vue项目:

 

//  第一种 无参数
  this.$router.replace({
        path: "/index"
 });

 

  // 第二种 有参数
  this.$router.replace({
        path: "/authorize/authorizeResult",
        query: {
            isSuccess: "0" //0表示失败
         }
   });

 

   

 // 第三种 无参数,(可返回)this.$router.push({
      path: "/Givingout/GivingoutRecord"
 });

 

posted on 2020-01-02 22:10  zhishiyv  阅读(349)  评论(0编辑  收藏  举报

导航