I am creating an account recovery process:
I have 3 components
Email
, Validación
andActualizar
But I need to send the parent to change state. that is, at the time of sending the Email data, it should pass to Validation. I have this in the parent as follows:
parent
data() {
return {
pageTotal: 3,
pageSelected: 1,
stepList: [
'Email',
'Validación',
'Actualizar'
]
}
}
In my component SendEmail
I have the following:
child
onSubmit(evt) {
evt.preventDefault()
let sendForm = {route: 'recovery', data: JSON.stringify(this.form)}
this.$store.dispatch('post', sendForm).then(response => {
//Llamar metodo de parent para que cambie de pagina.
}).catch(error => {
console.warn(error)
})
},
Does anyone know how I can call any method from the child?
You can achieve what you want using the property
$parent
like so: