search

Home  >  Q&A  >  body text

javascript - What is the difference between vue params and query

this.$router.push({
                name: 'A',
                query: {
                    id: 1,
                    name: 'a',
                }
            });
this.$router.push({
                name: 'B',
                params: {
                    id: 1,
                    name: 'b',
                }
            });

Except for the different address? What's the difference? I feel like these two have the same effect.

When to use query and when to use params? Or are they basically the same?

漂亮男人漂亮男人2748 days ago433

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-05-19 10:27:58

    /data/:id这个路由匹配/data/1,/data/2The id here is called params

    /data?id=1 /data?id=2 The id here is called query

    reply
    0
  • Cancelreply