Vue中通过路由传递参数

版权声明:本文为博主原创文章,转载请注明作者和出处,如有错误,望不吝赐教。 https://blog.csdn.net/weixin_41888813/article/details/84110569

Vue中可以通过路由传递参数,具体实现也比较方便


以 '/aaa/bbb?参数名='+参数值格式传递参数

let self = this;
let toPath = '/aaa/bbb?recordedSpeed='+self.recordedSpeed;
self.$router.replace({path: toPath});

beforeRouteEnter接收

vm.$route.query.传递过来的参数名;

beforeRouteEnter(to, from, next) {
            next(vm => {
                let id = vm.$route.query.recordedSpeed;
                alert('ididid'+id)
            });
        },

猜你喜欢

转载自blog.csdn.net/weixin_41888813/article/details/84110569