how to use vue-router params

后端 未结 4 1756
被撕碎了的回忆
被撕碎了的回忆 2021-02-12 08:06

I\'m new to vue now working with its router. I want to navigate to another page and I use the following code:

this.$router.push({path: \'/newLocation\', params:          


        
4条回答
  •  长发绾君心
    2021-02-12 08:59

    Try using query instead of params

    this.$router.push({path: '/newpath', query : { foo: "bar"}});
    

    And in your component

    console.log(this.$route.query.foo)
    

提交回复
热议问题