Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formspark/vue-use-formspark

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formspark/vue-use-formspark

Vue composition API functions for Formspark

  • 0.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
increased by183.33%
Maintainers
1
Weekly downloads
 
Created
Source

Formspark logo

vue-use-formspark

Vue composition API functions for Formspark.

Continuous deployment

Installation

# NPM
npm install @formspark/vue-use-formspark

# Yarn 
yarn add @formspark/vue-use-formspark

Usage

<template>
  <form @submit="onSubmit">
    <textarea v-model="message" @input="onInput"/>
    <button type="submit" :disabled="submitting">Send</button>
  </form>
</template>

<script>
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,
    };
  }
};
</script>

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

Keywords

FAQs

Package last updated on 08 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc