title: How do I pass parameters with router.push in vue.js?
body: <p>I'm working on a vue.js application. I'm trying to pass parameters in a redirect from one component to another like this:</p>
  <pre><code>      this.$router.push({
          path: '/my-path',
          query: {
            anArray: [...]
          }
        });
  </code></pre>
  <p>Once the component at my-path loads, I'm able to retrieve the parameters like this:</p>
  <pre><code>const theArray = this.$route.query.anArray;
  </code></pre>
  <p>The problem is that as soon as I refresh the page, the parameters are gone. When I open Chrome DevTools and put a break point where I retrieve the array from $route.query, I see this:</p>
  <pre><code>0: &quot;[object Object]&quot;
  1: &quot;[object Object]&quot;
  2: &quot;[object Object]&quot;
  </code></pre>
  <p>It seems obvious that it's getting this from the url which is:</p>
  <pre><code>http://localhost:8080/my-path?anArray=%5Bobject%20Object%5D&amp;anArray=%5Bobject%20Object%5D&amp;anArray=%5Bobject%20Object%5D
  </code></pre>
  <p>It doesn't seem to realize the 'object' terms in the url are just encodings of actual objects, which are available from $route.query the first time it loads.</p>
  <p>Is there another way to pass parameters to a component using $router.push() such that the parameters persist on the page even after refreshing?</p>
  <p>I could just try:</p>
  <pre><code>this.$router.push('/my-path?anArray=[...]');
  </code></pre>
  <p>...but my goal is to hide the parameters from the user (so don't show them in the url). This is another reason I'm looking for an alternate way of passing parameters (it doesn't even hide them).</p>
  <p>I also tried:</p>
  <pre><code>      this.$router.push({
          path: '/my-path',
          params: {
            anArray: [...]
          }
        });
  </code></pre>
  <p>...but this made the parameters unavailable in the component (I wonder if this has anything to do with our global router which routes '/my-path' to the MyPath component without specifying parameters; is it wiping out the parameters?).</p>
  <p>Thanks.</p>