zoukankan      html  css  js  c++  java
  • vue 路由监听

     

    监听路由 和 同页面跳转只有传递参数发生变化的问题

    解决方法:

    watch:{

      '$route' (tofrom) {

      console.log('to',to)

         console.log('from',from)

      },

    }

    路由跳转 

    方法一:

    路由跳转+传参

    this.$router.push({

      path: "/HomeResult",

      query: {

        indexId:'001'

      }

    });

    获取形式

      let indexId = this.$route.query.indexId;

    方法二:

    路由设置:

    path: '/Help/:indexId',

    路由跳转+传参

      this.$router.push("/Help/001");

    获取形式

      let indexId this.$route.params.indexId;

     

    方法三(使用路由打开新页面)

    路由跳转+传参

      let routeUrl = this.$router.resolve({

                  path: "/Help",

                  query: {

                    indexId:'001'

                  }

            });

          window.open(routeUrl.href, '_blank');

    获取形式

        let indexId = this.$route.query.indexId;

     

  • 相关阅读:
    linux常用命令中篇
    htaccess正则规则学习笔记整理
    个性签名
    求函数的单调区间
    函数的奇偶性
    函数的对称性
    函数的周期性
    复合函数
    赋值法
    高中数学中高频变形技巧收录
  • 原文地址:https://www.cnblogs.com/Li--gm/p/13219140.html
Copyright © 2011-2022 走看看