0👍
you can use beforeRouteLeave
hook to save the data in Vuex store. Here’s the example.
beforeRouteLeave (to, from, next) {
//Assuming you're storing your data in `configData`
store.dispatch('saveConfigData', configData)
//You can create a action (saveConfigData) in your store.
}
Then when component mounts, you can use this data from store via getter to set in page/input fields.
mounted() {
this.data = <datafromstore>
}
And you can clear your store values for config data once config form is submitted successfully.
- [Vuejs]-How add variable to django request from my front-end?
- [Vuejs]-How to delete data by id in vue axios
Source:stackexchange.com