P粉0236500142023-08-16 00:45:56
When the page is reloaded in a Vue app, the component's state is reset to its initial state and the data properties are returned to their default values, which is why you are encountering this behavior.
If you want to preserve v-else
state across page reloads, you can use different strategies, such as persisting state in local or session storage, cookies or URL state like Vue Router).
The easiest way is to save it in localStorage
. Please refer to this article to learn how to use localStorage
for binding.