0👍
✅
You can do this by following the below steps-
- Set-up Vuex in your project. (Vuex is a state management pattern + library for Vue.js applications.)
- Install vuex-map-fields. (Enable two-way data binding for form fields saved in a Vuex store.)
- Install vuex-persistedstate (Persist and rehydrate your Vuex state between page reloads.)
When you will bind your form variables, using map-fields, it will sync with the Vue state which will save the record, even on page reload with the help of vuex-persistedstate.
So, before submitting the form, if the user reloads the page, the data will be saved into the state and the preview will still there.
Here is an example of a form and preview of user-entered data, and on-page reload the data will be saved.
Source:stackexchange.com