I have a page with a DatePicker that returns me a range of dates that I'll use as params to a POST to a WebService. But how could I keep this date value in another page? I make the POST in another post and need the values from the DatePicker and I didn't figure it out how could I use router to keep the value.

What I'm doing now:

this.$store.state.primeiraData = this.primeiraData;

sendRequest() {
    var request = require("request");

    var options = {
      method: "POST",
      url: "http://XXX.xxx.X.Xx:8000/XxxXxxX",
      qs: { datade: this.$route.params.firstDate, dataate: this.$route.params.secondDate },
      headers: {
        "cache-control": "no-cache",
        "Content-Type": "application/json"
      body: { datade: this.$route.params.firstDate, dataate: this.$route.params.secondDate },
      json: true

    request(options, function(error, response, body) {
      if (error) throw new Error(error);
      console.log("return do post pro WS", body);

Someone could help me?

  • Can you specify if your pages are loaded through router-view (like SPA) or they are loaded completely independently? – Skipper Mar 11 at 22:11
  • All pages are views of the same project. (This answer your question?) – Mateus Fernando Mar 12 at 11:04

If you using SPA then put values to $store. If you using redirection then store value in localStorage via localStorage.setItem() and access it on another page using localStorage.getItem(). All should be done in saveRequest() method.

  • Could you please show me some sample of this? – Mateus Fernando Mar 12 at 11:08
  • See my code until now: jsfiddle.net/zcnkb2j3 I'm trying to use vuex to save the value, but IDK why the store aren't getting the values – Mateus Fernando Mar 12 at 12:33

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.