I have a fairly complex app which take the user through a 5-step process. I have a data object called userData which contains all their entry info (name, age, weight, heigh,etc).
At a certain point in the app I would like to take a snapshot of this data, and recall it if I need to. If I write it to a new var in the data object, it is dynamic. I want to create a static copy or snapshot of the data at stage 5.
How can I achieve this?
I have looked at
http://rc.vuejs.org/guide/application.html#State_Management
but maybe does not seem the way to go.
If you mean you just need to store a static copy of the data at that point in time, you can simply use any javascript method: Object.assign()
and store the variable in your data prop or if it doesn't need to be bound to the template, in your $options
this.$options.userCache = Object.assign({}, this.userData)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign