title: Store the elements of an object using vue.js
body: <pre><code>    data() {
          return: {
            user: {},
            userName: "",
            userAge: ""
      }
    },
  
  methods: {
  
      saveUserName: function() {
            this.userName = this.newUserName;
            this.$refs.userNameModal.hideModal();
            this.$session.set('userDetails', {userName: this.userName});
          },
  
      saveUserAge: function() {
            this.userAge = this.newUserAge;
            this.$refs.userAgeModal.hideModal();
            this.$session.set('userDetails', {userAge: this.userAge});
          },
  
      },
  
      beforeMount: function() {
      if (this.$session.exists('userDetails')) {
  
            this.user = this.$session.get('userDetails');
            console.log("userDetails", this.user)
          }
  
      }
  </code></pre>
  
  <p>I have a user form, which for every entry, a Modal pops up, and the user is 
   required to fill in, and by pressing a done button, the modal closes, calls a specific function(i.e saveUserName()), which the modal, and set it to session storage.
  So I am wondering how could I populate the user object time by time, and setting these values into my session storage??
  As at the moment, the first value gets reset, and the second one takes over, and in my case, my user object has either userName or userAge.
  What I am expecting instead (in the case that my session storage is not empty) from the log beforeMount is user: {userName: "Mario", userAge:27}
  Thanks</p>