Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/formspark/vue-use-formspark
Vue composition API functions for Formspark
https://github.com/formspark/vue-use-formspark
form forms jamstack static vue
Last synced: about 9 hours ago
JSON representation
Vue composition API functions for Formspark
- Host: GitHub
- URL: https://github.com/formspark/vue-use-formspark
- Owner: formspark
- License: mit
- Created: 2021-05-17T16:04:53.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-08T08:17:49.000Z (almost 3 years ago)
- Last Synced: 2024-11-07T18:16:30.941Z (8 days ago)
- Topics: form, forms, jamstack, static, vue
- Language: TypeScript
- Homepage:
- Size: 1.02 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vue-use-formspark
Vue composition API functions for Formspark.[![Continuous deployment](https://github.com/formspark/vue-use-formspark/workflows/Continuous%20deployment/badge.svg)](https://github.com/formspark/vue-use-formspark/actions?query=workflow%3A%22Continuous+deployment%22)
## Installation
```bash
# NPM
npm install @formspark/vue-use-formspark# Yarn
yarn add @formspark/vue-use-formspark
```## Usage
```vue
Send
import { ref } from "vue";
import { useFormspark } from "@formspark/vue-use-formspark";
export default {
setup() {
const message = ref("");
const [submit, submitting] = useFormspark({
formId: "your-form-id"
});const onInput = e => {
message.value = e.target.value;
};
const onSubmit = async e => {
e.preventDefault();
await submit({ message: message.value })
message.value = "";
};
return {
message,
onInput,
onSubmit,
submitting,
};
}
};```
**Note:** do not mistake action url (e.g. `https://submit-form.com/capybara`) and form id (e.g. `capybara`), this
package only uses the latter.## License
[MIT](https://opensource.org/licenses/MIT)