Skip to content

Commit

Permalink
feat: submit on keypress
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanvier committed Jan 16, 2024
1 parent 204ea47 commit 4d5261a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wgr-sa/nuxt-form",
"description": "Form builder for Nuxt",
"version": "0.7.6",
"version": "0.7.7",
"repository": "https://github.com/WGR-SA/nuxt-form.git",
"author": "jeanvier",
"license": "MIT",
Expand Down
11 changes: 10 additions & 1 deletion src/runtime/components/FormSubmit.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { inject } from 'vue'
import { inject, onMounted } from 'vue'
import { Form, useFormBuilder } from '#imports'
const props = defineProps<{ validateOnly?: boolean }>()
Expand All @@ -14,6 +14,15 @@ const submit = async () => {
form.submit()
}
}
onMounted(() => {
document.addEventListener('keypress', function (event) {
if (event.key === 'Enter') {
submit()
}
});
})
</script>

<template>
Expand Down

0 comments on commit 4d5261a

Please sign in to comment.