When transferring data between components, one effective solution is to utilize Vuex.
Vuex acts as a state management pattern and library designed for Vue.js applications. It functions as a centralized store for all components within an application, with strict guidelines ensuring that the state can only be altered in a predictable manner.
Another approach is to dispatch an event from the child component and then listen for it in the parent component.
In the template of App.vue:
<router-view @updateParent="handleUpdate"></router-view>
In the methods section of App.vue:
handleUpdate: function (value) {
this.parentData = value
}
In Login.vue, within the @click method:
onButtonClick: function () {
this.$emit('updateParent', "value")
}