当前位置:   article > 正文

解决:this.$router.push跳转同一个页面,参数不同不跳转的问题_this.$router.push("/serviceresult"); 携带参数 接收参数 不会变

this.$router.push("/serviceresult"); 携带参数 接收参数 不会变化

这里是跳转事件

this.$router.push({
                path: '/aaa',
                query: {
                    rightLabel: '这里是aaa',
                    labelId: 3,
                }
            });
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

这里是跳转到的页面,queryData需要先在data里定义

 watch: {
        // 利用watch方法检测路由变化:
        $route: function (to, from) {
            if (to.query.labelId !== from.query.labelId) {   //如果传过来的页面id不一样
                this.queryData = to.query // 获取参数 这里的queryData是我的路由参数
                this.rightLabel = this.queryData.rightLabel   //这里是页面展示的名称
                this.labelId = this.queryData.labelId   //页面传过来的id
            }
        }
    },
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/285271?site
推荐阅读
相关标签
  

闽ICP备14008679号