Last active
August 9, 2022 09:32
-
-
Save ricardov03/65b9fa73ce005a9c9363dae6d10cd6f0 to your computer and use it in GitHub Desktop.
This is how to create a custom call to the submit event of a form from another element.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script setup> | |
| import { ref } from 'vue' | |
| // The variable name should match the ref's name in the template. | |
| const newForm = ref(null) | |
| const submitForm = () => { | |
| // We need the value to access the element. | |
| newForm.value.submit() | |
| } | |
| </script> | |
| <template> | |
| <form ref="newForm"> | |
| <a @click="submitForm">Someter</a> | |
| </form> | |
| </template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment