Skip to content

Renderless Vue.js component for Mailchimp list subscriptions

License

Notifications You must be signed in to change notification settings

fredrivett/vue-mailchimp-subscribe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-mailchimp-subscribe

Renderless Vue.js component for Mailchimp list subscriptions.

Usage

<template>
  <mailchimp-subscribe
    url="https://xxx.xxx.list-manage.com/subscribe/post-json"
    user-id="xxx"
    list-id="xxx"
    @error="onError"
    @success="onSuccess"
  >
    <template v-slot="{ subscribe, setEmail, error, success, loading }">
      <form @submit.prevent="subscribe">
        <input type="email" @input="setEmail($event.target.value)" />
        <button type="submit">Submit</button>
        <div v-if="error">{{ error }}</div>
        <div v-if="success">Yay!</div>
        <div v-if="loading">Loading…</div>
      </form>
    </template>
  </mailchimp-subscribe>
</template>

<script>
import MailchimpSubscribe from 'vue-mailchimp-subscribe'

export default {
  components: {
    MailchimpSubscribe,
  },
  methods: {
    onError() {
      // handle error
    },
    onSuccess() {
      // handle success
    },
  },
}
</script>

About

Renderless Vue.js component for Mailchimp list subscriptions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%