0👍
data() {
return {
user: {
userName: "",
userAge: ""
},
};
},
methods: {
saveUserName: function() {
this.user.userName = this.newUserName;
this.$refs.userNameModal.hideModal();
this.saveUser();
},
saveUserAge: function() {
this.user.userAge = this.newUserAge;
this.$refs.userAgeModal.hideModal();
this.saveUser();
},
saveUser: function() {
this.$session.set('userDetails', this.user);
},
},
beforeMount: function() {
if (this.$session.exists('userDetails')) {
this.user = this.$session.get('userDetails');
console.log("userDetails", this.user)
}
}
Source:stackexchange.com