[Vuejs]-How to maintain the same value in a parent and a child component using bi-directional data binding in Vue.js

0👍

It sounds like the component is being destroyed and re-created when you navigate away and back. In this case, there is no way for the component to remember what the value of allowStart was.

Either you have to re-design the component architecture so that this particular component persists when you are navigating, or you need to use some kind of global state management system. The best option would probably be by using vuex. If you use vuex to store the state of allowStart, then when the component is re-created, you can read the value of the state.

If for some reason you don’t want to use vuex, you could also use the browser’s localStorage

Leave a comment