Home > front end >  Element UI vue call father and son component method to close the form clear data problem, submit the
Element UI vue call father and son component method to close the form clear data problem, submit the

Time:04-01

The parent page

//registered for el - el - form form of dialog

<script>

//introduction form form plugin
The import registered from "@/.../.../registered ";

Export the default {

Components: {
Registered
},
Methods: {
Registered () {
Enclosing dialogShowB=true
This $refs. Registered. ResetForm (' form ')
},
DialogShowBClose () {
Enclosing dialogShowB=false
},
}
}
</script>
Father call child pages method
Write the ref="registered" can call the method that page registered inside this. Writing $refs are fixed, registered is ref, resetForm method calls are page name
The son call the parent pages method
The parent component to write @ dialogShowBClose="dialogShowBClose"
Methods: {
Submit () {
This. $emit (' dialogShowBClose ', ')
}
}
Here enclosing $emit fixed writing dialogShowBClose method name is' 'a parameter if there is no voice of the empty

  • Related