首页 > 其他 > 详细

vue页面跳转

时间:2020-01-02 23:53:29      阅读:120      评论:0      收藏:0      [点我收藏+]

 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项目:

 if (res.resCode == "00") {
            // 保存用户信息
            sessionStorage.setItem("userId", res.userId);
            sessionStorage.setItem("merchantNo", res.merchantNo);
            sessionStorage.setItem("nickName", res.nickName);
            sessionStorage.setItem("openid", res.openid);
//第一种 无参数
            // 跳转主页
            this.$router.replace({
              path: "/index"
            });
          } else {
            // 调向授权结果页面 (失败)
//第二种 有参数
            this.$router.replace({
              path: "/authorize/authorizeResult",
              query: {
                isSuccess: "0" //0表示失败
              }
            });
  }

 

    //  第三种 无参数,(可返回)

 giveOutRecord() {
      console.log("发放记录");
      this.$router.push({
        path: "/Givingout/GivingoutRecord"
      });
  },

vue页面跳转

原文:https://www.cnblogs.com/Su-feng-address/p/12054526.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!